Skip to content

[Bug]: Codex subagent completion output can interleave with main-agent output #2477

Closed

Description

@lastobelus

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

  1. Use T3 Code with Codex.
  2. Start a main-agent turn that spawns a background/subagent.
  3. Have the main agent emit commentary while the subagent is completing.
  4. 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:

Activity

  1. paulhenri-l commented on Sep 3, 2026

    @paulhenri-l

    I’m seeing the same issue with Codex. Legacy token-by-token streaming is disabled.

    I initially thought this might be a Markdown rendering issue, but the garbled text is already present in T3 Code’s SQLite database. The DOM is simply displaying the corrupted stored message.

    For the affected response, I found three thread.message-sent events using the same assistant message ID. Their text lengths were 7,977, 716, and 513 characters, and the final projected message was 9,206 characters. Importantly, the first 7,977-character event was already corrupted.

    One example from the stored text:

    tmp/runs/gCurrent concrete11-f findingrozen:-p nom-bin RunancePod job-f hasusion/ beennormal launched.
    

    This may be slightly different from the original reproduction, where the persisted messages appeared to remain separate. In my case, the output seems to become interleaved before it reaches the UI—possibly while Codex main-agent and subagent output are being ingested around the same time.

  2. lastobelus commented on Sep 4, 2026

    @lastobelus
    ContributorAuthor

    Interesting, I have not seen this issue for quite some time even though I sometimes have 100+ subagent runs in a thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions