feat(doctor): Add orphan session and process detection

Add two new health checks to gt doctor:

1. orphan-sessions: Detects Gas Town tmux sessions (gt-*) that do not
   match expected patterns (mayor, deacon, rig-witness, rig-refinery,
   rig-polecat). Validates rig names against actual workspace structure.

2. orphan-processes: Detects Claude/claude-code processes without a
   tmux parent. Walks process tree to find orphaned instances that
   may be consuming resources.

Both checks support --fix to clean up detected orphans:
- Kills orphaned tmux sessions
- Sends SIGINT (then SIGKILL) to orphaned processes

Closes gt-qsvq.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-20 07:55:25 -08:00
parent 3921b0e8d8
commit 5645f0bb78
2 changed files with 441 additions and 0 deletions

View File

@@ -55,6 +55,8 @@ func runDoctor(cmd *cobra.Command, args []string) error {
// Register built-in checks
d.Register(doctor.NewDaemonCheck())
d.Register(doctor.NewBeadsDatabaseCheck())
d.Register(doctor.NewOrphanSessionCheck())
d.Register(doctor.NewOrphanProcessCheck())
// Run checks
var report *doctor.Report