Fix cross-beads slot references silently failing

When slinging work from town beads (hq-*) to a polecat whose agent bead
is in rig beads (gt-*), the hook_bead update was silently failing because
bd couldn't find the cross-beads reference.

Changes:
- sling.go: Use town root for routing instead of cwd, enabling cross-beads
  resolution via routes.jsonl. Log warnings on failure instead of silent ignore.
- done.go: Use townRoot (already available) instead of cwd for beads client.
  Log warnings on failure for both state and cleanup status updates.

Root cause: The beads client was created from current working directory,
which may not have access to routes.jsonl for cross-prefix resolution.
Town root always has routes.jsonl for proper prefix → rig directory mapping.

(gt-ohqxq)

🤖 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/crew/jack
2025-12-31 11:58:08 -08:00
committed by Steve Yegge
parent b7c26d52e1
commit cceacf2b04
2 changed files with 20 additions and 7 deletions

View File

@@ -312,10 +312,12 @@ func updateAgentStateOnDone(cwd, townRoot, exitType, issueID string) {
}
// Update agent bead with new state and clear hook_bead (work is done)
bd := beads.New(cwd)
// Use town root for routing - ensures cross-beads references work
bd := beads.New(townRoot)
emptyHook := ""
if err := bd.UpdateAgentState(agentBeadID, newState, &emptyHook); err != nil {
// Silently ignore - beads might not be configured
// Log warning instead of silent ignore - helps debug cross-beads issues
fmt.Fprintf(os.Stderr, "Warning: couldn't update agent %s state on done: %v\n", agentBeadID, err)
return
}
@@ -324,7 +326,8 @@ func updateAgentStateOnDone(cwd, townRoot, exitType, issueID string) {
cleanupStatus := computeCleanupStatus(cwd)
if cleanupStatus != "" {
if err := bd.UpdateAgentCleanupStatus(agentBeadID, cleanupStatus); err != nil {
// Silently ignore
// Log warning instead of silent ignore
fmt.Fprintf(os.Stderr, "Warning: couldn't update agent %s cleanup status: %v\n", agentBeadID, err)
return
}
}