fix(server): missed steers appear after the previous reply #27982
main fromrefs/pull/27982/head·opened View on GitHubProblem#
When a steer misses the active turn and starts a follow-up run, its user message keeps the timeline position allocated in the previous run. It can appear before that run's final reply, making the reply look like an answer to input the model only received afterward.
Observed with Claude on Windows: one clarification belonged to run 4145 but retained ordinal 4144000022, before run 4144's final reply. The message was sent once. Unchanged upstream main 80a2351fcb90 reproduces the same position error in the existing missed-steer integration test. This also affects a personal fork; it is not introduced by its patches. Related #23403 / #23420 addresses queued visibility and leaves item positions unchanged.
Change#
When normalizing a user message, reallocate its stored position if it lies outside its destination run's range. This makes the follow-up appear after the previous run. Streaming provider items retain their reserved positions and existing fast path. The position and event/projection changes share the existing transaction.
Extend the existing missed-steer integration test to check that the message appears once, belongs to the follow-up, and sorts after the previous run's items.
Scope and approval#
This is a small, focused fix for an obvious ordering inconsistency under CONTRIBUTING.md's exception: the timeline must place an input in the run that receives it. No delivery policy, UI layout, contract, or product default changes. The server position fix applies to web, desktop, mobile, and remote clients, independent of provider. Existing stored history is not migrated.
Verification#
- Before the fix, the extended test failed on upstream main: ordinal 1000002 was below the next run's 2000000 range.
- With the fix, both focused files passed all 24 tests:
SteeringCompletion.integration.test.tsandTurnItemPositionStore.test.ts. - On head
d190cee96a5fa33fb3006f4af145f80b5b397c15, the finalvp run check:changed upstream/mainexited 0: formatting, lint, both Knip stages, GraphQL generation, all three affected-package typechecks and all 25 selected tests passed. - Fork PR checks on the exact commit passed Quality, general Tests and server shards 1/3. Server shard 2 failed the unchanged
storageCleanup.test.tsinvalid-gitfile case (expected a kept worktree, received Git's invalid-repository diagnostic), and Web tests timed out in the unchanged ChatView new-draft test. These failures are outside the allocator and regression changed here; all 31 upstream checks passed on this head. The personal fork already carries the invalid-gitfile fix separately. - Independent GPT-6.1 Sol review found no actionable issues, including transaction boundaries, projection rebuilds, reverse promotion, and stable streaming positions.
- The final fork carry on nightly 3969 passed
check:changed(41 tests, all 39 mapped package typechecks and other selected checks), followed by full exact-commit fork CI. It shipped as v0.1.6-nightly.20261031.3969.fork.2, tagged at carry commit3ada4635158d947525ed11738ac8ae35ac3d56ab. The release workflow succeeded and verified all 10 Windows/Linux x64 assets. No installed-client acceptance is claimed. - No new live provider turn or browser/mobile session was run. This is a server state/order fix; the proof is the persisted-thread evidence and the orchestration regression, not a layout capture.
GPT-6.1 Sol through the Codex harness in T3 Code, with Claude Opus 5.5 diagnosis and implementation and independent GPT-6.1 Sol review.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
d190ceeMacroscope's review found this PR approvable — Missed steers now receive timeline positions in the run that actually handles them, placing them after the previous reply. The change is confined to ordering metadata within existing transactional writes and leaves message delivery and streaming-item positions unchanged.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).@codex review
Codex Review: Something went wrong. Try again later by commenting “@codex review”.
An unknown error occurredℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.- Last reviewed commit: 845c9555c0b5e97cfbed739429f48a98988dca7f
Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
The position allocator can reallocate an existing user-message position when it falls outside the resolved run bounds. Integration tests cover missed-steer positioning and the queue order of declined and subsequent steers.
Changes: Run-scoped message positioning
Layer / File(s) Summary Normalize and allocate run-scoped positions
apps/server/src/orchestration-v2/TurnItemPositionStore.tsallocateadds an optionalkeepWithinRunsetting. For user messages with a start time,normalizeenables it. The allocator retains an existing position if it is within the resolved run bounds or no run ordinal is resolved; otherwise, it deletes and reallocates the position.Verify steering position and queue order
apps/server/src/orchestration-v2/SteeringCompletion.integration.test.tsTests assert that a missed steer appears once in the subsequent run after the original run’s items. A second-steer timing case checks that the declined steer and later steer remain queued in order. Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk:
Minimal · up to845c9-
This change places a missed steer after the previous reply instead of before it. No concrete merge-blocking risk was found in the reviewed changes. Existing stored history is not repaired.
Pre-merge checks:
4-
Check name Status Explanation Title check The title "fix(server): missed steers appear after the previous reply" matches the main change. The raw summary shows the allocator now reallocates a user message's stored position when it falls outsi… Description check The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the observed misordering, the Change section explains the reallocation and the extend… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(server): missed steers appear after the previous reply" matches the main change. The raw summary shows the allocator now reallocates a user message's stored position when it falls outside the destination run's ordinal range, so the follow-up sorts after the prior run's items. The title is specific, uses a conventional commit prefix, and names the scope and the observed bug.
Full details: Description check
-
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the observed misordering, the Change section explains the reallocation and the extended test, and the Scope section explains why the fix is small and needs no separate issue. The Verification section lists focused test results, the check:changed run, and the fork CI status. It also states what was not checked, which the template requests. The description links related issues and CI runs, and it does not include an explicit screenshot or recording for a UI change, which is not needed here because the change is server-side. Minor gaps: the Scope section does not cite an issue that shows the bug. It cites CONTRIBUTING.md but does not link the bug report. The Verification section is long and includes fork-specific release details that are not needed for review. These gaps are not critical, so the description is mostly complete.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 121f0cf
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d507ee75-3ca9-4c6a-b52a-4edd71044adb
Commits-
Reviewing files that changed from the base of the PR and between 479655c54154cbc5db1a9c52d39bf2c7f97f5131 and 845c9555c0b5e97cfbed739429f48a98988dca7f.
Files selected for processing: 2-
apps/server/src/orchestration-v2/SteeringCompletion.integration.test.tsapps/server/src/orchestration-v2/TurnItemPositionStore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
verified as-is at
d190cee96a5fa33fb3006f4af145f80b5b397c15. no source changes or pushes were needed.ran
vp iand separate background dev servers forgithub/main(54c5f25249) and the exact pr head, stopping main before starting the pr. used repository playwright with/usr/bin/google-chromeon linux. added a project pointing at a real git repository through the app, created threads, and ran real codexgpt-6.1-solturns through the local proxy. no mocks, replay provider, fixtures, or seeded conversations were used for these scenarios.reproduced the completion race on both builds by clicking the actual steer control during a shell turn, with a brief node debugger pause immediately before the real
turn/steerrequest. codex completed independently during that pause. resuming let the real provider reject the late steer and the server start its follow-up. the pause controlled scheduling only; code, provider responses, and persisted records were unchanged.on main, the follow-up input appeared before
ORIGINAL_REPLY, although it belonged to run 2. on the pr,ORIGINAL_REPLYappears first, followed by the input once and thenFOLLOWUP_REPLY. reloading preserved the correct order.read-only sqlite transcript from the running servers:
build item run ordinal main follow-up user input 2 1000006 main ORIGINAL_REPLY 1 1000007 main FOLLOWUP_REPLY 2 2000001 pr ORIGINAL_REPLY 1 1000006 pr previous run max item 1 1000007 pr follow-up user input 2 2000001 pr FOLLOWUP_REPLY 2 2000002the pr has one user message and one user turn item for this follow-up. its position is inside run 2 and after every item from run 1.
nearby behavior also passed through the real ui and provider, without debugger pauses:
- active steering stayed in run 1 and changed the final answer to
ACTIVE_STEER_OK. - ctrl-click queueing waited for
QUEUE_FIRST, then delivered the queued message in run 2 and producedQUEUE_SECOND.
blacksmith passed both focused files (24 tests), then
vp run check:changed 80a2351fcb909034e65a512dfabeb3cdfd367762: formatting, lint, both knip stages, graphql generation, three affected typechecks, and 25 tests. the worker needed shallow parent history fetched before the changed-file check could run. existing pr ci reports 31 successful checks.before, main:

after, pr:

35-second recording of the real steer, controlled completion race, and corrected follow-up order:

Not verified#
native ios/android, the electron shell, windows/macos, claude and other providers, and remote/relay/tunnel connections were not exercised on this linux vm. the timing race was controlled with the debugger; no claim is made about its natural frequency. existing stored history was not migrated or repaired by this check.
takeover follow-up#
merged current main into the existing contributor branch without rebasing or force-pushing. resolved the allocator conflict by keeping both main's run_start placement and this pr's user-message run reassignment. the diff against the merged main remains two files, 39 additions and 2 deletions. pushed
d97b46928cbadfe2e25dda50c110adbbd50acdff.two independent source reviews found no actionable issues on this head. github reports no conflicts. the evidence above belongs to the original head and was not repeated on the merged head.
verification is blocked by runner availability: the task-owned blacksmith worker stayed queued for more than eleven minutes, and the new github ci run remained queued with no jobs assigned. blacksmith dependency installation, focused allocator/steering tests, lint, typecheck, and
vp run check:changedcould not run. the old ci run has no reported failing checks; fetching its failed-job logs returned github HTTP 502 twice. this head is not yet verified or ready to merge.- active steering stayed in run 1 and changed the final answer to
tanstack-source added labelsbug
This PR conflicts with
main. Rebase it or mergemaininto it. If it still conflicts after 7 days with no activity, it will be closed automatically.See the conflict window.
github-actions[bot](GitHub profile, opens in a new tab) added labelsneeds-rebase
juliusmarminge added labelstakeover:in-progress
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything.
What was run on
121f0cf014, the commit before this change:On each commit, created a small git repository and a Haiku thread, then completed a READY warm-up turn. Ran 46 attempts using the sleep 2; echo prompt and STEER-: also say the word banana. Steering offsets cycled through 3800, 4100, 4400, 4700, 5000, 5300, 5600, 5900, 6200, 6500 and 6700 milliseconds. Added one attempt sending the steer as soon as FINAL-R01 became readable. Recorded both sequences, reloaded both clients, inspected the final ordering, and compared settled screenshots taken more than 500 ms apart. Each side had 47 banana inputs and zero final positions outside their assigned run ranges. No misplaced input was observed.
How: Manual comparison in the real web app, Chromium preview browser, 1280x800 CSS viewport, light theme. Each commit ran from its own checkout with a fresh database and T3CODE_DEV_SEED=0. Synthetic project and threads were created through application CLI commands. Used real Claude Haiku 4.5 through the configured hub, with a custom model entry preserving claude-haiku-4-5-20251001. The same browser driver invoked the client's command APIs on both sides. Replay was unsuitable because its generic ACP provider does not support active steering.
Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened.
juliusmarminge closed this
juliusmarminge removed labelstakeover:in-progress
juliusmarminge added labelstakeover:blocked
Sign in to join this conversation.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
We couldn’t complete this review. Comment
@codex reviewto try again.d190ceeℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.