Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
The problem needs a steer that misses its turn: a message sent with Steer while a run is active, where the turn ends before the steer is delivered, so the server starts it as the next run instead. A steer that reaches its turn is placed correctly, so a repro must make the steer miss.
Deterministic (server, no provider account needed). On main at 77b38f9b09, add these assertions to the end of the existing test starts a steer that missed the turn on the saved next-turn selection in apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts, after assert.deepEqual(projection.thread.modelSelection, composerSelection);:
const messages = projection.turnItems.filter(
(item) => item.type === "user_message" && item.messageId === MessageId.make("message:steer"),
);
assert.lengthOf(messages, 1);
assert.equal(messages[0]!.runId, started[1]!.runId);
assert.isAtLeast(messages[0]!.ordinal, started[1]!.runOrdinal * 1_000_000);
assert.isAbove(
messages[0]!.ordinal,
Math.max(
...projection.turnItems.filter((item) => item.runId === first.runId).map((item) => item.ordinal),
),
);Then run cd apps/server && vp test run src/orchestration-v2/SteeringCompletion.integration.test.ts -t "starts a steer that missed the turn".
That test already sends a steer to run 1, completes run 1's provider turn before the steer is delivered, and checks that the steer starts run 2. The added lines check where the message sits in the timeline.
In the app (timing-dependent).
- Start a turn whose last step is a tool call followed by a short text reply, e.g.
Run "sleep 5" in the shell, then reply with just DONE. - While
sleep 5is running, or asDONEstarts streaming, send a second message with Steer. - Repeat until the steer misses the turn: run 1 ends with
DONE, and the steer starts a new run that answers it separately. - Look at the timeline, and reload it.
Whether a steer misses depends on whether the turn ends before the steer reaches the provider. Upstream's adapters usually deliver steers fast enough, so step 3 may take many tries. The automated check on #27982 ran 47 attempts with no steer missing its turn, so it never reached the bug.
Expected behavior
A steer that misses its turn and starts the next run appears in that run, after run 1's final reply. The timeline order should match what the model received.
Actual behavior
The message keeps the timeline position it got as a steer in run 1, even though its runId is run 2. The test above fails with:
AssertionError: expected 1000002 to be at least 2000000
- Expected
+ Received
- 2000000
+ 1000002
In the app the message appears inside run 1, above run 1's final reply. That reply then looks like an answer to the message, and run 2 answers it again, so it looks as though the message was sent twice. It was sent once.
Observed in real use (a fork that holds Claude steers until the next tool boundary, which makes missed steers common): a message sent during the turn's last Bash call belonged to run 4145 but kept ordinal 4144000022, before run 4144's final reply. The positioning code involved (TurnItemPositionStore.allocate returning the existing ordinal of a reused user-message turn item) is unchanged on upstream main.
Impact
Minor bug or occasional failure
Version or commit
main @ 77b38f9
Environment
Windows 11, desktop app; seen with Claude (Opus) through the Claude Agent provider. The deterministic repro above is provider-independent.
Logs or stack traces
No response
Workaround
None. Existing history keeps the wrong position after reload.
Related
- fix(server): missed steers appear after the previous reply #27982 proposed a fix (move a reused user message into the run that receives it). It was closed because the app check could not reproduce the bug; that check never had a steer miss its turn.
- A steer returned to the queue appears delivered before its run starts #23403 covers a requeued steer looking delivered before its run starts (visibility, not position).
Filed by Claude Opus 5.5 on behalf of Alb11747.
Activity
docs(fork): track the steer-placement repro issue after pingdotgg#27982…