fix: Remove PID/tmux state inference (gt-psuw7)

ZFC compliance: daemon becomes pure transport layer, trusting agent beads.

Changes:
- refinery Status(): Simply returns loaded state, no PID/tmux reconciliation
- witness Status(): Simply returns loaded state, no PID inference
- daemon ensureDeaconRunning(): Trusts agent bead state, no tmux fallback
- daemon pokeDeacon(): Trusts agent bead state, no HasSession check

Removed:
- 78 lines of state inference code (PID checks, tmux session parsing)
- "Reconciliation" logic that overwrote agent-reported state

Note: Timeout fallback for dead agents is gt-2hzl4 (separate issue).

Reference: ~/gt/docs/zfc-violations-audit.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-28 01:56:42 -08:00
parent 597c6b8071
commit 2d6b93f26b
3 changed files with 17 additions and 95 deletions

View File

@@ -96,44 +96,10 @@ func (m *Manager) saveState(ref *Refinery) error {
}
// Status returns the current refinery status.
// ZFC-compliant: trusts agent-reported state, no PID/tmux inference.
// The daemon reads agent bead state for liveness checks.
func (m *Manager) Status() (*Refinery, error) {
ref, err := m.loadState()
if err != nil {
return nil, err
}
// Check if tmux session exists
t := tmux.NewTmux()
sessionID := m.sessionName()
sessionRunning, _ := t.HasSession(sessionID)
// If tmux session is running, refinery is running
if sessionRunning {
if ref.State != StateRunning {
// Update state to match reality (non-fatal: state file update)
now := time.Now()
ref.State = StateRunning
if ref.StartedAt == nil {
ref.StartedAt = &now
}
_ = m.saveState(ref)
}
return ref, nil
}
// If state says running but tmux session doesn't exist, check PID
if ref.State == StateRunning {
if ref.PID > 0 && processExists(ref.PID) {
// Process is still running (foreground mode without tmux)
return ref, nil
}
// Neither session nor process exists - mark as stopped (non-fatal: state file update)
ref.State = StateStopped
ref.PID = 0
_ = m.saveState(ref)
}
return ref, nil
return m.loadState()
}
// Start starts the refinery.