fix(polecat): kill orphan sessions and clear stale hooks during allocation (#448)

ReconcilePool now detects and kills orphan tmux sessions (sessions without
corresponding polecat directories). This prevents allocation from being
blocked by broken state from crashed polecats.

Changes:
- Add tmux to Manager to check for orphan sessions during reconciliation
- Add ReconcilePoolWith for testable session/directory reconciliation logic
- Always clear hook_bead slot when reopening agent beads (fixes stale hooks)
- Prune stale git worktree entries during reconciliation

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen
2026-01-13 21:37:00 +00:00
committed by GitHub
parent bd2a5ab56a
commit 65c5e05c43
10 changed files with 297 additions and 34 deletions
+1 -1
View File
@@ -682,7 +682,7 @@ func cleanupPolecats(townRoot string) {
for _, r := range rigs {
polecatGit := git.NewGit(r.Path)
polecatMgr := polecat.NewManager(r, polecatGit)
polecatMgr := polecat.NewManager(r, polecatGit, nil) // nil tmux: just listing, not allocating
polecats, err := polecatMgr.List()
if err != nil {