You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(daemon): nudge agents on state divergence instead of silent accept
When the daemon detects that an agent bead state doesn't match tmux
(e.g., bead says stopped but Claude is running), it now:
1. Logs the divergence clearly with STATE DIVERGENCE prefix
2. Nudges the agent with an actionable command to fix its state
3. Still skips the restart (safety - don't kill healthy sessions)
This prevents silent state drift where bead state diverges from reality.
Applied to: Deacon, Witness, Refinery ensure functions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d.logger.Println("Deacon session healthy (Claude running), skipping restart despite stale bead")
328
+
// STATE DIVERGENCE: tmux shows running but bead disagrees.
329
+
// Don't kill (safety), but nudge the agent to reconcile its state.
330
+
// This prevents silent state drift where bead and reality diverge.
331
+
d.logger.Printf("STATE DIVERGENCE: Deacon bead='%s' but Claude is running in tmux", beadState)
332
+
nudgeMsg:="[DAEMON] State divergence detected: your agent bead shows '"+beadState+"' but you appear running. Please run: bd agent state "+deaconSession+" running"
// Session is healthy (Claude running) - bead state was stale
464
-
d.logger.Printf("Witness for %s session healthy (Claude running), skipping restart despite stale bead", rigName)
470
+
// STATE DIVERGENCE: tmux shows running but bead disagrees.
471
+
// Don't kill (safety), but nudge the agent to reconcile its state.
472
+
d.logger.Printf("STATE DIVERGENCE: Witness for %s bead='%s' but Claude is running in tmux", rigName, beadState)
473
+
nudgeMsg:="[DAEMON] State divergence detected: your agent bead shows '"+beadState+"' but you appear running. Please run: bd agent state "+agentID+" running"
// Session is healthy (Claude running) - bead state was stale
526
-
d.logger.Printf("Refinery for %s session healthy (Claude running), skipping restart despite stale bead", rigName)
537
+
// STATE DIVERGENCE: tmux shows running but bead disagrees.
538
+
// Don't kill (safety), but nudge the agent to reconcile its state.
539
+
d.logger.Printf("STATE DIVERGENCE: Refinery for %s bead='%s' but Claude is running in tmux", rigName, beadState)
540
+
nudgeMsg:="[DAEMON] State divergence detected: your agent bead shows '"+beadState+"' but you appear running. Please run: bd agent state "+agentID+" running"
0 commit comments