feat(daemon): respect rig operational state for auto-start

Update daemon to check rig config before auto-starting agents:
- Check wisp config "status" - skip if parked or docked
- Check "auto_restart" config - skip if blocked or false
- Log skip reason for visibility

Affects ensureWitnessRunning, ensureRefineryRunning,
restartPolecatSession, and lifecycle restartSession.

(gt-68c46)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rictus
2026-01-06 19:29:58 -08:00
committed by Steve Yegge
parent 87169a3fc7
commit d00e73f110
2 changed files with 60 additions and 0 deletions
+9
View File
@@ -339,6 +339,15 @@ func (d *Daemon) restartSession(sessionName, identity string) error {
return fmt.Errorf("parsing identity: %w", err)
}
// Check rig operational state for rig-level agents (witness, refinery, crew, polecat)
// Town-level agents (mayor, deacon) are not affected by rig state
if parsed.RigName != "" {
if operational, reason := d.isRigOperational(parsed.RigName); !operational {
d.logger.Printf("Skipping session restart for %s: %s", identity, reason)
return fmt.Errorf("cannot restart session: %s", reason)
}
}
// Determine working directory
workDir := d.getWorkDir(config, parsed)
if workDir == "" {