Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Codex subagent terminal statuses fall through to `running` in orchestrator v2 #11164

Closededuardozf(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Check out PR #2829.
  2. Start a Codex thread using orchestrator v2.
  3. Spawn a subagent.
  4. Interrupt or shut down the subagent, or process a collaboration state where Codex reports notFound.
  5. Inspect the subagent status recorded by T3.

This can also be reproduced directly by passing each Codex collaboration status through updateSubagentStates.

Expected behavior

T3 should translate each Codex status into the corresponding internal status:

Codex statusExpected T3 status
pendingInitpending
runningrunning
interruptedinterrupted
completedcompleted
erroredfailed
shutdowncancelled
notFoundfailed

These are the statuses in Codex’s current AgentStatus definition.

Actual behavior

While reviewing issue #8499, I found that PR #2829 already fixes the reported registration problem. The completed spawnAgent event exposes the child thread ID through receiverThreadIds, the PR registers it, and the adapter also handles the newer subAgentActivity path while buffering child turns that arrive before registration.

I verified those paths against Codex CLI rust-v0.150.1, the version reported in #8499, and the latest openai/codex main branch.

During that review, I found a separate bug in updateSubagentStates. It checks for failed, cancelled, and closed, but Codex never sends those values. Several real Codex statuses therefore fall through to running:

Codex statusCurrent T3 status
pendingInitrunning
runningrunning
interruptedrunning
completedcompleted
erroredfailed
shutdownrunning
notFoundrunning

The effects are:

  • An interrupted child continues to appear active.
  • A shut-down child remains running, with no completion timestamp.
  • A missing child remains active even though Codex can no longer find it.
  • A child that is still initializing appears to be executing.

This is not a later Codex protocol change. T3’s generated Codex schema already contained these statuses when the mapper was introduced in cc5967e2.

Impact

Major degradation or frequent failure

Version or commit

PR #2829 at 89459e384ad7ffa3b9dda613e9cfebf32a8979e1

Environment

Tested Codex CLI rust-v0.150.1 and openai/codex main at 28f43b0417ab19632f7e53d17806b98151d6b9a0

Created using GPT-5.6-Sol
  1. eduardozf(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. Triage

    Confirmed. This is a real mapper bug on orchestrator v2, not a protocol change and not a duplicate of #8499.

    updateSubagentStates in apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts (PR #2829 @ 89459e38) compares Codex agentsStates.status against T3-internal values (failed, cancelled, closed) that Codex never sends. The generated CollabAgent union has been pendingInit | running | interrupted | completed | errored | shutdown | notFound since the mapper was added in cc5967e2, matching Codex AgentStatus.

    Current fall-through:

    CodexT3 todayShould be
    pendingInitrunningpending
    runningrunningrunning
    interruptedrunninginterrupted
    completedcompletedcompleted
    erroredfailedfailed
    shutdownrunningcancelled
    notFoundrunningfailed

    Effects match the report: initializing children look like they are executing; interrupted / shut-down / missing children stay running and never get completedAt (emitSubagentTaskUpdate only stamps terminal statuses).

    The subAgentActivity kind === "interrupted" path is already correct. The broken path is collabAgentToolCall → updateSubagentStates. There is no agentsStates coverage in CodexAdapterV2.test.ts.

    #8499 is the registration/visibility issue. #2829 already registers receiverThreadIds; that does not fix this status map. Keep both open.

    Next step: land an exhaustive CollabAgent-status switch plus per-status tests on #2829 before relying on Codex subagent lifecycle in v2.

  3. juliusmarminge added labelsaccepted

  4. juliusmarminge removed labelsneeds-triage

  5. juliusmarminge added labelsvia-triage

  6. Fixed by merged PR #12974 (supersedes open #11996), which normalizes every Codex native subagent status in the orchestrator v2 adapter. Closing as completed.

  7. juliusmarminge closed this

Sign in to join this conversation.