feat(deacon): add stale hooked bead cleanup (gt-2yls3)

Add `gt deacon stale-hooks` command to find and unhook stale beads.

Problem: Beads can get stuck in 'hooked' status when agents die or
abandon work without properly unhooking.

Solution:
- New command scans for hooked beads older than threshold (default 1h)
- Checks if assignee agent is still alive (tmux session exists)
- Unhooks beads with dead agents (sets status back to 'open')
- Supports --dry-run to preview without making changes

Also adds "stale-hook-check" step to Deacon patrol formula.

🤖 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/gus
2026-01-06 13:20:45 -08:00
committed by Steve Yegge
parent ac63b10aa8
commit 74409dc32b
3 changed files with 320 additions and 1 deletions

View File

@@ -340,10 +340,43 @@ gt mail send mayor/ -s "Health: <rig> <component> unresponsive" \\
Reset unresponsive_cycles to 0 when component responds normally."""
[[steps]]
id = "stale-hook-check"
title = "Cleanup stale hooked beads"
needs = ["health-scan"]
description = """
Find and unhook beads stuck in 'hooked' status.
Beads can get stuck in 'hooked' status when agents die or abandon work without
properly unhooking. This step cleans them up so the work can be reassigned.
**Step 1: Preview stale hooks**
```bash
gt deacon stale-hooks --dry-run
```
Review the output - it shows:
- Hooked beads older than 1 hour
- Whether the assignee agent is still alive
- What action would be taken
**Step 2: If stale hooks found with dead agents, unhook them**
```bash
gt deacon stale-hooks
```
This sets status back to 'open' for beads whose assignee agent is no longer running.
**Step 3: If no stale hooks**
No action needed - hooks are healthy.
**Note**: This is a backstop. Primary fix is ensuring agents properly unhook
beads when they exit or hand off work."""
[[steps]]
id = "zombie-scan"
title = "Backup check for zombie polecats"
needs = ["health-scan"]
needs = ["stale-hook-check"]
description = """
Defense-in-depth check for zombie polecats that Witness should have cleaned.