Skip to content

Subagent completion result can be lost after parent thread compaction #26728

@Victor-Quqi

Description

@Victor-Quqi

What version of Codex CLI is running?

codex-cli 0.137.0

What subscription do you have?

Other

Which model were you using?

gpt-5.5

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What terminal emulator and version are you using (if applicable)?

PowerShell 7.6.2

Codex doctor report

Not included.

What issue are you seeing?

A subagent can finish without its result being delivered back to the parent thread if the parent compacts while the subagent is still running.

The sequence I saw is:

  1. Parent spawns a subagent.
  2. Subagent keeps working in the background.
  3. Parent thread compacts.
  4. Subagent finishes.
  5. Parent never receives the subagent completion/result message.

After that, the parent behaves as if the subagent never reported back.

What steps can reproduce the bug?

  1. Start a Codex CLI session with subagents enabled.
  2. Spawn a subagent for a task that takes long enough to still be running after the parent continues.
  3. Trigger context compaction in the parent thread before the subagent finishes.
  4. Let the subagent finish after compaction.
  5. Check the parent thread.

The expected subagent completion message does not appear.

What is the expected behavior?

A subagent result should still be delivered to the parent if the parent compacts before the subagent finishes.

Compaction should not make the parent lose a later child completion/result message.

Additional information

This looks related to the parent mailbox / pending-input path used for multi-agent completion delivery. My guess is that compaction replaces the active parent task and the queued child completion is either dropped or never surfaced into the resumed parent context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingcontextIssues related to context management (including compaction)subagentIssues involving subagents or multi-agent featureswindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions