Skip to content

[Bug]: Codex V2 run stays "running" after the native turn fails immediately (modelNotFound) #28032

Closed

Description

@niieani

Version: T3 Code Nightly 0.1.6-nightly.20261031.3956, headless t3 serve on Linux amd64. Codex CLI app-server, ChatGPT account.

What happened

A thread was created over MCP (t3_thread_launch) with an explicit Codex model the account cannot use (gpt-5-codex). Codex rejected the turn about 2 s after it started and reported the turn as failed. T3 never finalized the run:

  • The thread status stayed running.
  • The run's status stayed running, with completedAt: null.
  • The thread got no error item. Its only items were the user message and "Workspace ready".
  • So nothing watching the run, such as MCP wait/notification clients, saw a terminal state.

The run stayed like this until it was interrupted by hand about 2 minutes later.

Expected

The run ends as failed, with Codex's failure message shown on the thread ("The 'gpt-5-codex' model is not supported when using Codex with a ChatGPT account.").

Native event sequence (provider event log, abridged)

07:16:12.577  → turn/start
07:16:12.586  ← warning  "Model metadata for `gpt-5-codex` not found. Defaulting to fallback metadata…"
07:16:12.616  ← thread/status/changed
07:16:12.616  ← turn/started        turn 01a190d0-e8a6-7d81-98fa-60dfe00d8656
07:16:14.682  ← thread/status/changed
07:16:14.683  ← error              {"error":{"message":"The 'gpt-5-codex' model is not supported when using Codex with a ChatGPT account.","codexErrorInfo":"modelNotFound"},"willRetry":false,"turnId":"01a190d0-e8a6-…"}
07:16:14.690  ← thread/readState/changed
07:16:14.690  ← turn/completed      {"turn":{"id":"01a190d0-e8a6-…","status":"failed","error":{"message":"…not supported…","codexErrorInfo":"modelNotFound"},"durationMs":2098}}
… nothing for this run until …
07:18:05.981  → turn/interrupt   (manual stop)

T3 thread state read about 70 s after turn/completed:

{"status":"running","activeRunId":"run:…:ordinal:1",
 "recentRuns":[{"status":"running","startedAt":"2026-10-31T07:16:12.475Z","completedAt":null}],
 "itemCount":2}

Where it may be

apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts at the tag:

  • The turn/completed handler returns early when activeTurns has no context for the turn id. It doesn't log anything, and it never finalizes.
  • The error handler (willRetry: false) only records latestProviderFailure after awaitActiveTurn(turnId).

If the turn's context isn't in activeTurns when turn/completed arrives, the terminal event is dropped silently. That can happen if registration races the fast failure, or if the error handler is still waiting in awaitActiveTurn. Not verified; the event timing above is the evidence.

Related but different: #15197 (Claude run stays running after result/success), #27348 (OpenCode turn stuck).

Repro

  1. On a Codex instance signed in with a ChatGPT account, launch a thread with modelSelection: {provider: "codex", model: "gpt-5-codex"} (any model the account rejects).
  2. Observe the native turn/completed with status: "failed".
  3. Observe that the T3 run remains running indefinitely.
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