[Bug]: Codex subagent completion output can interleave with main-agent output
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Summary
Codex subagent completion output can interleave mid-token with main-agent assistant output in the visible chat UI.
The persisted messages/events appear to remain separate, but the rendered chat text can splice the two outputs together.
Example
Expected separate text fragments:
Include constraints: read-only, use a specific tool, don’t modify files.
I’m seeing a clear split: short diagnostic nudges during debugging...
Observed rendered text:
Include constraints: read-only, use a specific tool, don’tI modify’m seeing files a. clear split...
Reproduction Shape
- Use T3 Code with Codex.
- Start a main-agent turn that spawns a background/subagent.
- Have the main agent emit commentary while the subagent is completing.
- Observe the visible chat output when both messages arrive close together.
Expected Behavior
Main-agent messages and subagent completion messages should render as separate chat items, or otherwise remain textually isolated.
Actual Behavior
The UI can render a single garbled assistant output where text from the subagent completion and main-agent commentary are interleaved mid-token.
Evidence
In one observed case, local provider logs showed two separate item/completed events about 72 ms apart:
- one for main-agent commentary
- one for subagent final output
The local SQLite projection also contained separate assistant message rows. This suggests the issue is likely in stream/render/event assembly rather than model output.
Impact
This makes Codex subagent workflows hard to trust because final answers can appear corrupted even when the underlying stored events are distinct.
Related Issues
Possibly related to prior stream/rendering issues:
- #1147
- #349
- #2380
- #538
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the T3 Code scenario with a Codex main agent and background subagent, then trace the stream, render, and event-assembly path where the two item/completed events arrive close together. Compare the visible chat with provider logs and the local SQLite projection; done means main-agent commentary and subagent completion output remain separate chat items or textually isolated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100