fix: add Pin/Unpin methods and call bd pin in pinToHook (gt-o3is)

Adds Pin() and Unpin() methods to the beads wrapper that call bd pin/unpin.

Updates pinToHook() to call b.Pin() after AttachMolecule() to set the
pinned boolean field and assignee on the work issue. This should enable
bd hook to show pinned work.

NOTE: There's a known issue where bd pin via subprocess doesn't actually
set the pinned field even though it reports success. The handoff bead
attachment remains the primary mechanism until this is resolved.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 04:51:00 -08:00
parent cab3b2ec50
commit 84aa69207a
2 changed files with 30 additions and 1 deletions

View File

@@ -387,6 +387,25 @@ func (b *Beads) CloseWithReason(reason string, ids ...string) error {
return err
}
// Pin pins an issue to an agent's hook.
// This sets the pinned boolean field and optionally the assignee.
// If agent is empty, only sets the pinned field.
func (b *Beads) Pin(id string, agent string) error {
args := []string{"--no-daemon", "pin", id}
if agent != "" {
args = append(args, "--for="+agent)
}
_, err := b.run(args...)
return err
}
// Unpin removes the pinned flag from an issue.
func (b *Beads) Unpin(id string) error {
args := []string{"unpin", id, "--json"}
_, err := b.run(args...)
return err
}
// Release moves an in_progress issue back to open status.
// This is used to recover stuck steps when a worker dies mid-task.
// It clears the assignee so the step can be claimed by another worker.