fix(server): steer a turn only when one is actually running - #264
Merged
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This was referenced Sep 4, 2026
Merged
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.
Problem
Messages sent to a Claude thread that showed "Working" could vanish. Claude Code emits
system/statusnotifications between turns (for example when a background task finishes). The adapter maps those torunning, so the projected session sat inrunningwith no active turn and no active request id, sometimes for hours.The decider treated any
runningsession as steerable and admitted the next user message as asteerwith no pending admission. The adapter started a real turn for it, but ingestion's strict admission gate discards turn-scoped events whose admission request id does not match the session's active request id, which was undefined. The turn ran to completion in Claude and none of it was persisted: no turn start, no assistant text, no activities, no error.Traced from the nightly database and provider logs: seven such admissions across three threads since September 2, each a silently lost response. Both halves of the admission model are Pylon-only (
8d3fd193d7,3ba49ed5a2), so this is not an upstream regression.Fix
The decider now picks
steeronly when the session isrunningand has an active turn. Otherwise it issues an exactstartwith a pending admission, which the reactor already handles for a live session and which ingestion correlates through the existing CAS accept path.Added a decider test that reproduces the exact state from the incident (
running,activeTurnId: null, no active request id) and asserts astartintent with a pendingstartingsession-set.Second commit
A running turn the provider opened on its own (Claude continuing after a background task) has no admission request id either. Steering it tags the provider's next turn with an id the gate cannot correlate, so the same loss happens. Under an incarnation-tracked session every admitted turn carries its request id, so a running turn without one now gets an exact start too. Sessions without an incarnation predate admission tracking and keep plain steering, which the existing ingestion tests cover.
Verification
vp test runon decider, command invariant, provider command reactor, and provider runtime ingestion tests: 17 files, 267 passedvp run -F t3 typecheck: cleanvp fmt --checkandvp linton the touched files: cleanFollow-ups (separate PRs)
runningonsystem/statuswhen no turn is active. That is what makes the sidebar say "Working" for an idle thread.Model: Claude Fable 5.1. Harness: Pylon (Claude Code provider).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.