[Bug]: Abandoned Codex draft is flushed after the final answer and hides it
Resolution
Confirmed duplicate of #18652, fixed by merged #19023 / a917d843b3. The installed .3315 release points to 9c161462c94f and excludes the fix. Nightly .3335 points to b72740852ffb and includes it; verified with Git ancestry. The relevant update is the Windows host, where the execution service runs.
On unmodified main 6fca698c59, vp test run apps/server/src/orchestration-v2/RunExecutionService.test.ts apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts passes all 69 tests, including the held-draft/steer regression. An initial adapter-only investigation missed the downstream reservation and is superseded by this verification. No duplicate PR is needed.
Area
apps/server (Codex adapter text buffering), with a visible effect in the chat timeline.
Steps to reproduce
- Start a Codex turn that asks an asynchronous clarification question while continuing to work.
- Answer the question while an assistant response is starting. In the observed turn, Codex abandoned the prefix
The files are intact and, continued with the clarification, and later completed a different, full final answer. - Let the turn finish and view the collapsed
Worked for …response.
The relevant minimal notification shape is an assistant text delta for draft A, a completed final answer B, and then turn/completed without an item/completed for A. The buffered A is first published/completed during the final turn flush, after B.
Expected behavior
The newer completed answer remains visible. Flushing an earlier partial draft must not move it after the newer answer in the durable timeline.
Actual behavior
The visible reply was just The files are intact and. The full transfer confirmation was still in the saved conversation but hidden in the collapsed work section.
Read-only inspection of the persisted turn items found:
| Item | Started (UTC) | Completed/published (UTC) | Durable ordinal |
|---|---|---|---|
| Full final answer | 04:28:32.800 | 04:28:33.444 | 5000037 |
| Older partial draft | 04:26:36.136 | 04:28:33.568 | 5000038 |
The native Codex rollout records the full final answer and names it as task_complete.last_agent_message. It records one native turn for this request, with no retry or duplicate turn. The short draft has no corresponding completed assistant message in that rollout.
Investigation
makeAssistantStreamingFilter holds assistant text until a paragraph boundary. The abandoned prefix never reached one, so its streaming updates were held without being written. At turn end, the Codex adapter's flushTurn emitted the prefix as completed, after the real answer.
TurnItemPositionStore.normalize assigns stable ordinals at the first durable write. An adapter-local ordinal reserved at item/started does not reserve that database position. The old draft therefore became the newest assistant message and chat folding left it visible. PR #19023 fixes this in RunExecutionService by reserving a held item's database position on the first streaming update, before the filter can withhold its text.
This is the specific ordering defect from #18652, rather than the broader folding-policy discussion in #8879.
Impact
Major degradation: completed answers appear lost, prompting users to repeat work or assume provider tokens were consumed without a result.
Version and environment
- T3 Code host:
0.1.1-nightly.20261018.3315, Windows x64 - Client: macOS desktop, connected to the Windows environment
- Provider/model: Codex /
gpt-6.1-sol - Occurred October 19, 2026, at approximately 00:28 EDT
- Investigation is against current
mainat6fca698c59.
Screenshot
Original user-provided screenshot of the affected response:

Workaround
Expand Worked for … to find the complete reply. The answer is present in saved state; retrying the provider turn is unnecessary.
Additional evidence
These are real UI captures from an isolated development database seeded from the affected turn. The corrected fixture uses the item order preserved by the existing fix; it is visual evidence of rendering, not a claim that the live installation was upgraded. Backend behavior was verified separately by the execution/steering tests above.


Before recording, corrected-order recording, and sanitized persisted ordering.
[!NOTE] Grok responding on behalf of Julius.
This is the same bug as #18652. A held draft that never reaches a paragraph boundary is first written when flushTurn runs at turn end, so it takes its position after the real answer and becomes the visible reply. Steer, reconnect, or an abandoned prefix like yours all hit that one path.
#19023 fixed it by reserving the draft's position on its first streaming update, so the late flush keeps its original slot. Your host build, 0.1.1-nightly.20261018.3315, was cut before #19023 merged, so it doesn't have the fix. Reading main doesn't show that, because the reservation lives in RunExecutionService, not the Codex adapter.
Closing as a duplicate. If it still happens on a nightly that includes #19023, comment here with the turn item ordinals.
Confirmed, thank you. Git ancestry verifies that installed nightly .3315 (9c161462c94f, published 13:53 UTC) excludes a917d843b3, while nightly .3335 (b72740852ffb, published 23:06 UTC) includes it.
I reran the execution and steering tests on unmodified main 6fca698c59: both files pass, 69/69 tests, including the held-draft regression. My initial adapter-only replay was too shallow to exercise the reservation in RunExecutionService; I have corrected the report rather than opening another PR.
The report now also links real before/corrected-order UI screenshots and recordings from an isolated copy of the affected turn, with the fixture limitation stated explicitly. No live database or installation was modified.