fix(hook): Read hook_bead from database column, not description (gt-7m33w)

The hook discovery code was reading hook_bead from the agent bead's
description field (parsed via ParseAgentFieldsFromDescription), but
the slot update code writes to the hook_bead database column via
'bd slot set'. This mismatch caused polecats to see stale hook values
from the description instead of the current value from the database.

Fixed in:
- molecule_status.go: Use agentBead.HookBead instead of parsing description
- status.go: Use issue.HookBead directly
- lifecycle.go: Update all GUPP and orphan detection to read from
  database columns instead of parsing description

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/polecats/furiosa
2026-01-01 17:38:39 -08:00
committed by Steve Yegge
parent 65a5c7888f
commit 278abf15d6
3 changed files with 44 additions and 41 deletions

View File

@@ -322,11 +322,13 @@ func runMoleculeStatus(cmd *cobra.Command, args []string) error {
if err == nil && agentBead != nil && agentBead.Type == "agent" {
status.AgentBeadID = agentBeadID
// Parse hook_bead from the agent bead's description
agentFields := beads.ParseAgentFieldsFromDescription(agentBead.Description)
if agentFields != nil && agentFields.HookBead != "" {
// Read hook_bead from the agent bead's database field (not description!)
// The hook_bead column is updated by `bd slot set` in UpdateAgentState.
// IMPORTANT: Don't use ParseAgentFieldsFromDescription - the description
// field may contain stale data, causing the wrong issue to be hooked.
if agentBead.HookBead != "" {
// Fetch the bead on the hook
hookBead, err = b.Show(agentFields.HookBead)
hookBead, err = b.Show(agentBead.HookBead)
if err != nil {
// Hook bead referenced but not found - report error but continue
hookBead = nil