fix(server): render async Codex messages #9227
main fromrefs/pull/9227/head·opened View on GitHubProblem#
Codex emits send_user_message_async as a separate completed agent message during an active turn. Provider ingestion always matched an assistant completion to the turn's active streamed segment, so whenever commentary was already streaming, the async message's text was dropped: the completion finalized the commentary segment instead of creating its own message (#9222).
Change#
The assistant completion handler matches the active segment by provider item ID. A completion for a different item becomes its own assistant message, and the original segment stays active, so later deltas on it keep appending to the same message. Segment state is cleared only when the completing item is the active one. The handler keeps main's direct projection reads (getThreadMessageById, projectionThreadMessages.hasAssistantMessageForTurn).
Scope and approval#
Bug fix for #9222. The issue has no maintainer triage comment yet; a maintainer reviewed this approach and asked for the rebase and the test shape used here: https://github.com/pingdotgg/t3code/pull/9227#issuecomment-5625197060
Verification#
- Established the problem with a focused ingestion test: commentary delta, then two async assistant completions on other items, then another commentary delta and its completion. Against main's
ProviderRuntimeIngestion.tsit fails: "Still investigating." is missing from the thread. - Rebased onto main at 0cf482b in this session. The regression now uses
emitAndDraininstead ofwaitForThreadpolling. vp test run src/orchestration/Layers/ProviderRuntimeIngestion.test.ts(fromapps/server): 92 passed, including the new case, which asserts exactly three non-streaming assistant messages with the full commentary text "Working on it. Applying the fix.".- Server
tsc --noEmit: exit 0.vp lintandvp fmt --checkon both changed files: clean. - Not checked: a live Codex session that emits
send_user_message_async. Server-only change, no UI.
Fixes #9222.
Implemented with gpt-5.6-sol in the Codex harness through T3 Code. Rebase, test rework, and body update by Claude Opus 5.5 via Claude Code.
- 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:S
Approvability#
Verdict: Approved at
2f5a860Macroscope's review found this PR approvable — This is a focused server-side bug fix that preserves streamed commentary while rendering unrelated async Codex messages separately. The production change is localized and accompanied by a regression test covering multiple async completions and continued streaming.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Note: GPT-6 on behalf of shivam (@shivamhwp).
Please rebase the item-ID match onto the current completion handler while preserving its direct projection queries. Current main uses
getThreadMessageByIdandprojectionThreadMessages.hasAssistantMessageForTurn; restoring the old whole-thread detail read would undo that change.Use the existing
emitAndDrainhelper for the new regression instead ofwaitForThreadpolling. Include two async completions followed by another delta on the original item, so the regression covers both repeated updates and continued commentary.juliusmarminge added labelsmacroscope-review
Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 5 minutes.
View limit details
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
67e99001-ad15-426d-9d7f-7042f6a0f73e📥 Commits
Reviewing files that changed from the base of the PR and between c57a04b722f2172e3be2c8f73c936d10b4582431 and 2f5a860f1dd0366ce2db0296d6692349ec3b8df1.
📒 Files selected for processing (2)
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.tsapps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
Comment `@coderabbitai help` to get the list of available commands.[claude-opus-5-5] Responding on behalf of Guille
@shivamhwp Rebased in 2f5a860f1d. The item-ID match now sits on the current completion handler and keeps
getThreadMessageByIdandprojectionThreadMessages.hasAssistantMessageForTurn; no whole-thread detail read. The regression usesemitAndDrainand covers two async completions followed by another delta on the original commentary item, then its completion (three non-streaming messages, commentary text intact). It fails against main's handler and passes here; the full ingestion suite (92) passes.macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.
This change touches ProviderRuntimeIngestion.ts, which the V2 merge removed. V2 ingests typed provider events into run and turn-item projections.
Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed