fix(hook): warn when hooked bead is already closed

When a bead is closed externally via bd close, it could remain on
an agent's hook, causing confusion when running gt hook. Now
gt hook detects closed beads and shows a warning message with
instructions to clear the hook using gt unsling.

Closes: gt-8w0r6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dementus
2026-01-09 21:36:56 -08:00
committed by beads/crew/giles
parent aeb4c0d26f
commit 2f50a59e74

View File

@@ -603,6 +603,14 @@ func outputMoleculeStatus(status MoleculeStatusInfo) error {
fmt.Println(style.Bold.Render("🚀 AUTONOMOUS MODE - Work on hook triggers immediate execution"))
fmt.Println()
// Check if the hooked bead is already closed (someone closed it externally)
if status.PinnedBead.Status == "closed" {
fmt.Printf("%s Hooked bead %s is already closed!\n", style.Bold.Render("⚠"), status.PinnedBead.ID)
fmt.Printf(" Title: %s\n", status.PinnedBead.Title)
fmt.Printf(" This work was completed elsewhere. Clear your hook with: gt unsling\n")
return nil
}
// Check if this is a mail bead - display mail-specific format
if status.PinnedBead.Type == "message" {
sender := extractMailSender(status.PinnedBead.Labels)