Problem
When af cleanup --project N runs, it:
- Removes the worktree
- Deletes local and remote branches
- Kills the Tower terminal registration
But it does NOT kill the shellper process. The shellper continues running as an orphan, consuming resources. After cleaning up 6 builders, 20+ orphaned shellper processes were found still running.
Repro
af spawn 100 --protocol bugfix
- Wait for builder to complete
af cleanup --project 100
ps aux | grep shellper | grep 100 — process still running
Expected
af cleanup should kill the shellper process (and any child processes like claude) before removing the worktree.
Where to Look
packages/codev/src/agent-farm/commands/cleanup.ts — cleanup logic
packages/codev/src/terminal/session-manager.ts — session teardown
- The cleanup code calls
killTowerTerminal() but this only removes the Tower registration, it doesn't send a kill signal to the shellper process
Problem
When
af cleanup --project Nruns, it:But it does NOT kill the shellper process. The shellper continues running as an orphan, consuming resources. After cleaning up 6 builders, 20+ orphaned shellper processes were found still running.
Repro
af spawn 100 --protocol bugfixaf cleanup --project 100ps aux | grep shellper | grep 100— process still runningExpected
af cleanupshould kill the shellper process (and any child processes like claude) before removing the worktree.Where to Look
packages/codev/src/agent-farm/commands/cleanup.ts— cleanup logicpackages/codev/src/terminal/session-manager.ts— session teardownkillTowerTerminal()but this only removes the Tower registration, it doesn't send a kill signal to the shellper process