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:
@@ -64,9 +64,10 @@ func SpawnPolecatForSling(rigName string, opts SlingSpawnOptions) (*SpawnedPolec
|
||||
return nil, fmt.Errorf("rig '%s' not found", rigName)
|
||||
}
|
||||
|
||||
// Get polecat manager
|
||||
// Get polecat manager (with tmux for session-aware allocation)
|
||||
polecatGit := git.NewGit(r.Path)
|
||||
polecatMgr := polecat.NewManager(r, polecatGit)
|
||||
t := tmux.NewTmux()
|
||||
polecatMgr := polecat.NewManager(r, polecatGit, t)
|
||||
|
||||
// Allocate a new polecat name
|
||||
polecatName, err := polecatMgr.AllocateName()
|
||||
@@ -124,8 +125,7 @@ func SpawnPolecatForSling(rigName string, opts SlingSpawnOptions) (*SpawnedPolec
|
||||
fmt.Printf("Using account: %s\n", accountHandle)
|
||||
}
|
||||
|
||||
// Start session
|
||||
t := tmux.NewTmux()
|
||||
// Start session (reuse tmux from manager)
|
||||
polecatSessMgr := polecat.NewSessionManager(t, r)
|
||||
|
||||
// Check if already running
|
||||
|
||||
Reference in New Issue
Block a user