Skip to content

fix(router): route synthetic wake busy through the session manager - #396

Merged
yicheng47 merged 1 commit into
mainfrom
fix/385-router-nudge-busy-status
Aug 10, 2026
Merged

fix(router): route synthetic wake busy through the session manager#396
yicheng47 merged 1 commit into
mainfrom
fix/385-router-nudge-busy-status

Conversation

@yicheng47

Copy link
Copy Markdown
Owner

Fixes #385.

Root cause

Two independent "is this runner busy" stores could diverge: the router's synthesize_wake_busy appended a synthetic runner_status busy directly to the log without updating session.activity — the dedup key the forwarder consults. When the agent's first output byte landed inside the suppressed-busy window, the forwarder's busy was swallowed with activity still Idle, so the end-of-turn idle was deduped as a no-op and the rail stayed busy forever. A stuck handle is also permanently ineligible for the reconciliation nudge, so this could silently stall missions.

Changes

  • synthesize_wake_busy now routes its append through the SessionManager, which writes the event and updates session.activity under one session lock — the two stores can no longer drift, and the existing dedup works as intended. Wakes at a dead slot no longer append an uncleareable busy (early return instead).
  • try_append_runner_status retries on flock contention (8 attempts × 5 ms, bounded < 50 ms) instead of dropping — status events are load-bearing now that the reconciliation gate reads them.
  • Regression tests: both stores updated by the synthetic busy with the final idle emitted; the suppressed-busy → output → quiet sequence still yields a logged idle; bounded retry recovers a contended append; retry budget stays bounded under persistent contention.

Checks

  • cargo test --workspace (540 runner + 8 CLI + 16 roundtrip + 22 runner-core), cargo clippy, cargo fmt --check — all green locally.
  • Crew-reviewed on the working-tree diff (mission 01KZMYBZPR…): no must-fix findings; both reviewer nice-to-haves folded in.

🤖 Generated with Claude Code

The router's nudge-time busy event now appends via the SessionManager
so the forwarder dedup key (session.activity) updates atomically with
the log write; a direct append left the key stale and the paired
end-of-turn idle was deduped away, sticking the rail on busy.
Also retry runner_status try-appends (8 x 5ms) so flock contention
can't silently drop a load-bearing transition.
@yicheng47
yicheng47 merged commit bdd2d7f into main Aug 10, 2026
2 checks passed
@yicheng47
yicheng47 deleted the fix/385-router-nudge-busy-status branch August 10, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mission): runner status stuck on busy after a nudge — synthetic busy bypasses the forwarder's dedup key

1 participant