Skip to content

[Bug]: Codex turns started by codex queue run in T3's app-server but never appear in the thread #23919

Description

@matthewdean-semgrep

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. Start a Codex thread in T3 and let its turn finish, so the provider session stays loaded.
  2. Within T3's idle window, queue a message for that thread from outside T3:
    codex queue --thread <codex thread id> --message "Reply with the word QUEUED."
  3. Wait about 10 seconds. Codex's queue watcher polls every 10 s and on thread-idle.
  4. Look at the thread in T3.

We found this through a plugin rather than a manual codex queue. The plugin does work asynchronously after the agent edits files. Under Codex, which has no asyncRewake, it reports results that arrive after the turn has ended by running codex queue --thread <id> --message <results>. The manual steps above use the same path.

Expected behavior

T3 shows the queue-triggered turn in the thread: the queued message, the agent's reply, and any tool calls. It's like how T3 shows Claude turns started by a background wake. Approvals requested during that turn reach the user.

Actual behavior

Codex runs the turn in T3's app-server process, but T3 never records it.

  • The thread in T3 still shows one run, ending with "READY". The queued message and the "QUEUED" reply never appear, and the thread's updatedAt stays at the end of the first run.
  • The model did receive and act on the queued message. With the plugin, the same thing happened: the model got the plugin's results and the user saw nothing.

What we think is happening:

  • Codex's queue watcher starts the turn (turn_trigger: "queue") in whichever app-server has the thread loaded. That's T3's process: openai/codex codex-rs/ext/queue/src/service.rs.
  • CodexAdapterV2.ts has no handler for thread/queue/changed.
  • In the turn/started handler, a turn that is neither in activeTurns nor in pendingRootTurns falls through to the sub-agent bookkeeping (rememberSubagentTurnStarted, which parks it in pendingSubagentTurns). The turn is never projected as a run. References are to upstream main at 5127302.

Impact

Minor bug or occasional failure

Version or commit

main @ 5127302

Environment

Linux (Ubuntu-based dev container), Codex provider, gpt-5.6-luna.

Logs or stack traces

03:24:46.250  turn/completed            agentMessage "READY"   (the T3 run)
03:25:03      codex queue ... exits 0: "Queued message ... for thread ..."
03:25:11.704  thread/queue/changed
03:25:11.725  turn/started              (native turn id unknown to T3)
03:25:11.746  item/completed            userMessage "Reply with the word QUEUED."
03:25:12.765  item/completed            agentMessage "QUEUED"
03:25:12.805  hook/started / hook/completed (Stop)
03:25:12.973  turn/completed

Screenshots, recordings, or supporting files

No response

Workaround

None in T3. Plugin authors can avoid codex queue by returning results synchronously from a blocking Stop hook ({"decision":"block","reason":...}), which continues the same turn. That doesn't help other external callers of codex queue.

Activity

  1. added
    bug
    needs-triage
    on Oct 23, 2026
  2. Pseudogiant-xr commented on Nov 23, 2026

    @Pseudogiant-xr

    Independent reproduction with timings, in case it helps choose between #24439 and #34930.

    Setup. T3 Code Nightly 0.1.12-nightly.20261123.5138 on Windows 11, Codex CLI 0.171.0. A Codex thread started by T3 (scratch workspace) ran one turn and went idle. About a minute later an MCP server running inside that thread's Codex session ran codex queue --thread <id> --message <notice> (no --resume) to wake it.

    What happened (local time, from T3's provider event log for the thread, Codex's log database and the thread's rollout):

    Time Event
    03:15:26.584 T3 sends turn/start (the only one it ever sent for this thread)
    03:16:04.624 turn/completed for that turn; T3 shows it
    03:17:03.155 the managed Codex daemon receives thread/queue/add from codex queue
    03:17:05.174 T3's own stdio app-server child logs thread/queue/changed, then submits the queued input as a new turn; the rollout records turn_trigger: "queue"
    03:17:05.232 T3's provider log shows the incoming turn/started for the new turn id
    03:17:05 to 03:17:43 T3's provider log shows the turn's item/* notifications arriving (86 lines carry the new turn id)
    03:17:43.883 T3's provider log shows the incoming turn/completed
    03:18:04.635 T3 sends thread/unsubscribe

    Observed in T3. The thread view still shows one run, last item 03:16:04, status completed. Nothing from the second turn appears, although its tool calls really ran and every notification for it reached T3 on the same connection that served the first turn. No warning or "unknown turn" line was logged.

    Two details that may be new here.

    1. Which process ran the queued turn: T3's own app-server child for the thread, not the managed daemon and not another client. The daemon only accepted the thread/queue/add; the T3-spawned stdio app-server picked the item up from the shared queue store about two seconds later. So T3 is the one client that could show the turn, and it has all the events in hand.
    2. The idle release is counted from the last turn T3 requested. thread/unsubscribe went out at 03:18:04.635, exactly 120 s after the first turn's turn/completed (03:16:04.624) and 21 s after the queued turn finished; a queued turn still running at that point would be unsubscribed mid-turn. A fix that adopts externally started turns probably wants to reset the idle timer when one starts and when it completes.
    3. After the unsubscribe the thread cannot be woken from inside its own session at all. In a second run I left the thread idle for four and a half minutes instead of one: T3 unsubscribed 120 s after the turn (03:37:38.513 to 03:39:38.525), Codex then shut the thread's MCP servers down, and the MCP server that would have run codex queue was gone, so no wake was attempted and the thread stayed idle. I did not test an external codex queue after the unsubscribe. This is by design on T3's side as far as I can tell, but it means a codex queue based wake only works inside that two-minute window unless something pins the session, which is worth knowing when deciding how adopted turns interact with the idle release.

    Happy to share the redacted provider log lines for the second turn if useful.

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

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions