fix(router): route synthetic wake busy through the session manager - #396
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #385.
Root cause
Two independent "is this runner busy" stores could diverge: the router's
synthesize_wake_busyappended a syntheticrunner_statusbusy directly to the log without updatingsession.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 withactivitystillIdle, so the end-of-turn idle was deduped as a no-op and the rail stayedbusyforever. A stuck handle is also permanently ineligible for the reconciliation nudge, so this could silently stall missions.Changes
synthesize_wake_busynow routes its append through theSessionManager, which writes the event and updatessession.activityunder 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_statusretries 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.Checks
cargo test --workspace(540 runner + 8 CLI + 16 roundtrip + 22 runner-core),cargo clippy,cargo fmt --check— all green locally.01KZMYBZPR…): no must-fix findings; both reviewer nice-to-haves folded in.🤖 Generated with Claude Code