Active Codex goals get paused by the goal-turn-without-run guard during normal operation, without a server restart #32691
What happened#
On a long-running headless server, active Codex goals keep stopping on their own. The agent finishes a turn, and a little later the goal is paused and Codex's next goal turn is interrupted, although nobody stopped it. The thread then sits idle until someone resumes the goal by hand. The server was not restarted in this period, so this is not the restart case from #21865.
Diagnosis#
The server log shows the guard orchestration-v2.codex-goal-turn-without-run firing 35 times in 6 days, on 18 native Codex threads. That guard pauses the goal (thread/goal/set with status: paused) and interrupts the turn (CodexAdapterV2.ts, the branch after the pendingRootTurns and goalHolds checks in the turn/started handler).
We mapped 14 of the 18 native threads to T3 threads in orchestration_v2_projection_provider_threads and looked up the provider turn right before each guard event in orchestration_v2_projection_provider_turns. For 17 of the 18 events that we could map, that turn had status = completed. In 11 of the 17, the guard fired 20 to 160 s after that completion, which looks like Codex starting its next goal turn. The other 6 came 45 min to 8.7 h later.
From reading the source on main (8b44f42b1, approximate, since our build is a nightly):
goalHoldsis set only inemitOrDeferRootTerminalwhenholdsForGoalis true. That needsgoalsByNativeThread.get(nativeThreadId)?.status === "active"(or an activegoalActivationsentry) at the moment the root turn completes.- The guard needs
goalsByNativeThreadstatusactive(or agoalStopsentry) when the next turn starts.
So in these cases T3's cached goal status was not active when the turn completed, but was active (or a stop was pending) when Codex started the next goal turn. We have not found out what changed it in between. A thread/goal/updated ordering race around turn/completed, or a goalStops entry left behind, would explain it, but that is a guess.
Separately, 4 of the 14 threads also hit EmptyInput from #20232 in the same period. The other 10 did not, so most cases are not explained by that bug.
Steps to reproduce#
We do not have a deterministic reproduction. What we saw:
- Run
t3 servefor days with several Codex threads that each have an active/goal. Agents start new turns in those threads now and then. - Watch the server log for
orchestration-v2.codex-goal-turn-without-run. - Each guard event sends
thread/goal/setwithstatus: pausedand thenturn/interruptfor Codex's new turn, although nobody had asked for a stop.
The Codex protocol logs under logs/provider did not cover any of the 35 events, so we could not look at the exact notification order.
Version#
0.1.6-nightly.20261029.3892 (server, from server-runtime.json). The server ran without a restart from 2026-10-29 21:04 CET until this report.
Environment#
Linux x64 headless server, t3 serve as a systemd user service. Codex through one shared codex app-server (codex-cli 0.166.0 now; app-server sessions earlier in the window may have used an older Codex). About 20 coding agents, Codex and Claude, on one server.
Evidence#
# counts from boot-service.log, only lines written by 0.1.6-nightly.20261029.3892
35 orchestration-v2.codex-goal-turn-without-run (18 native threads)
43 orchestration V2 provider turn start failed (all: CodexAppServerRequestError: failed to submit turn input: EmptyInput, #20232)
# one guard event
[14:00:45.191] WARN: orchestration-v2.codex-goal-turn-without-run
{ nativeThreadId: '01a19b4b-…', nativeTurnId: '01a19c59-…' }
# provider turn before each mapped guard event (status, seconds from its completion to the guard event)
completed 21, 26, 31, 31, 40, 47, 47, 108, 109, 127, 157 | completed 2708, 3091, 3243, 9546, 11356, 31222 | cancelled 892
Related issues#
- #21865 and PR #25935: the same guard, for goal turns after a server restart. Here the server did not restart, and the guard did fire. It paused goals that were still meant to run. - #20232:
/goal resumewithEmptyInput. It overlaps with 4 of the 14 threads only.
Fix applied or workaround#
None on the server. An agent that notices the pause has to resume the goal itself.
Filed by#
Claude Opus 5.5 (Claude Code via T3 Code) on behalf of Philip, following the T3 triage playbook without running t3 triage.
phkoenig(GitHub profile, opens in a new tab) added labelsvia-triage
juliusmarminge added labelsneeds more info
Thanks for the detailed report. I tried to reproduce this on current
main(a9e709f15f) and could not trigger the guard in normal operation. Here's what I ran:- Real T3 dev server with Codex (codex-cli 0.163.0), fresh database. I started a
/goalthat runs over several turns and sent a second message into the thread while the goal was running (it was steered in). Codex continued the goal on its own across turns, the goal completed, andorchestration-v2.codex-goal-turn-without-runnever fired. - Raw
codex app-serverprobes checking the notification order T3 depends on:- When Codex continues a goal, it sends
thread/goal/updated(active) beforeturn/completed, and the nextturn/startedfollows in the same millisecond. T3's 5 s hold catches that turn. - After a turn ends as
interrupted, Codex leaves the goalactivebut idle and starts no turn. - In that active-but-idle state,
thread/resume(T3 sends this after an idle thread is unloaded, by default after 30 minutes) makes Codex start a goal turn immediately after the resume response. That turn would hit this guard. This could explain your 6 long-gap events (45 min to 8.7 h), but it does not explain the 11 events that came 20 to 160 s after a completed turn.
- When Codex continues a goal, it sends
To narrow down the short-gap cases, could you share the following from
boot-service.log, with paths and objectives redacted as you like?- For two or three of the 20 to 160 s guard events: every line that mentions that
nativeThreadId, plus allWARN/ERRORlines from about 5 minutes before the event until it fired. - Counts over the same 6 days for
orchestration-v2.codex-goal-continuation-expired,orchestration-v2.codex-goal-pause-failed,orchestration-v2.codex-goal-turn-stop-failed, anddriver-session.idle-unload/idle-release. - For the turn just before a guard event: did the goal run end on its own, or did someone (a user or an agent) stop it, send
/goal pauseor/goal resume, or start a new turn in that thread? - Whether anything besides T3 connects to the same shared
codex app-server, such as the Codex CLI/TUI or a second T3 server, especially on the same threads.
- Real T3 dev server with Codex (codex-cli 0.163.0), fresh database. I started a
github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds more info
Note
🤖 Claude Opus 5.5 responding on behalf of Philip.
Thanks for trying it. We caught two new events on Nov 7, this time with the Codex protocol lines from T3's provider log, so I can answer all four points.
1. Two events with their notification order (UTC, IDs shortened, objectives left out)
07:35:06.260 Codex→T3 turn/completed turn …d8e0e4a6, completed 07:35:13.000 T3→Codex thread/unsubscribe 07:35:20.731 T3 thread user message "/goal resume" 07:35:21.916 T3→Codex thread/resume 07:35:22.455 Codex→T3 thread/goal/updated active 07:35:22.590 Codex→T3 turn/started turn …3abafbec 07:35:22.591 T3→Codex thread/goal/set paused <- guard 07:35:22.630 T3→Codex turn/interrupt turn …3abafbec 07:35:23.837 T3→Codex turn/start input [] 07:35:23.864 T3→Codex thread/goal/set active 07:35:23.882 Codex→T3 turn/started turn …2fc670aeThe second event, at 08:11 the same day, follows the same pattern:
turn/completedat 08:11:14.2,thread/unsubscribeat 18.9,thread/resumeat 25.5.thread/goal/updated(active) at 25.94,turn/startedat 25.997, the guard's pause at 25.998.- Then
turn/startwith empty input andthread/goal/set(active) at 26.05 to 26.09.
I could not find the message that triggered this second one.
So the short-gap events are the resume case you describe. The difference is that the
thread/unsubscribecame 5 to 7 s after the turn completed, not after 30 minutes. In the first event it also came before the/goal resumemessage, so the message did not cause it. Neither window has anidle-unloadline, and I don't know what triggered the unsubscribe. In both events the goal was active again 0.1 to 1.3 s after the guard. The guard interrupted Codex's own continuation, and then T3 started its own turn. In these two cases, then, the goal did not stay paused, and my report overstated the impact.2. Counts for version
0.1.6-nightly.20261029.3892, from its start on Oct 29 to now, including one restart on Nov 5:codex-goal-turn-without-run: 37codex-goal-continuation-expired: 0codex-goal-pause-failed: 0codex-goal-turn-stop-failed: 0driver-session.idle-unload-failed: 2driver-session.idle-release-deferred: 94- no other
idle-unloadoridle-releaselines
3. The turn before. In both captured events it ended on its own as
completed. In the first one, our own agent automation sent/goal resumeinto the thread 14 s later, although the goal was still active. That is on our side, and I am checking why it does that.4. Other clients. Nothing else connects to T3's
codex app-server: it is the only child oft3 serveand has its ownCODEX_HOME. Othercodex app-serverprocesses on the machine belong to a quota probe with a separateCODEX_HOME, so they don't share threads with T3.tanstack-source added labelsbug
@phkoenig For the two captured events (07:35 and 08:11 on Nov 7), which provider-session.detached event did T3 record for that thread just before the thread/unsubscribe, and what was its reason (Thread settled, Runtime mode changed, Provider or model selection changed, Workspace changed, or Thread archived)? For example, did your automation settle or reconfigure the thread right after the turn completed?
Note
🤖 Claude Opus 5.5 responding on behalf of Philip.
I can't give you the recorded event. Since the 0.1.7 update on Nov 8, projection maintenance (#29806) has pruned those threads' Nov 7 events. Both windows (07:35:00–07:35:25Z and 08:11:00–08:11:30Z) keep only one
run.updated(statusrunning) each, at 07:35:22.862 and 08:11:25.957. The server log at info level has no line for the detach either.What I can say about our side, from our own logs and code:
- No scheduled job or other automation of ours dispatches
thread.settle,thread.runtime-mode.set,thread.archiveorthread.metadata.update. Those come only from manual actions in our own UI, and its action log no longer reaches back to Nov 7, so I can neither confirm nor rule out a manual action. - Our account-switch service ran inside both windows (07:35:09, 07:35:11, 07:35:13 and 08:11:18, 08:11:21) and switched nothing either time, so no provider or model reselection came from it.
- The only automated action near the first case was the
/goal resumemessage at 07:35:20.731, after thethread/unsubscribeat 07:35:13. - I can't rule out that the agent in the thread settled its own thread through the thread tools (
settle-after-run).
Starting today, our capture job also saves the T3 events of the last 45 minutes whenever
codex-goal-turn-without-runfires, before pruning removes them (provider-session.detachedwith its reason, settles, archives, metadata and runtime-mode changes). I'll post the reason with the next occurrence.- No scheduled job or other automation of ours dispatches
juliusmarminge added labelsneeds more info
juliusmarminge removed labelsneeds more info
@phkoenig For your next captured occurrence, what did T3 record just before the early thread/unsubscribe: the provider-session.detached event with its reason (Thread settled, Runtime mode changed, Provider or model selection changed, Workspace changed, Thread archived), or no detach at all? And did a thread/goal/updated notification (with its status) arrive between the turn/completed and the thread/unsubscribe?
juliusmarminge added labelsneeds more info
Closing: no reply in 7 days after we asked for more information. Comment with the missing details and we will reopen.
juliusmarminge closed this
Note
🤖 Claude Opus 5.5 responding on behalf of Philip.
Sorry for the late reply. These are the missing details. We captured 21 occurrences between Nov 11 and Nov 20; 15 of them have T3's events and the Codex protocol lines around them.
Detach before the early
thread/unsubscribe: In 12 of the 15, T3 recordedprovider-session.detached5 to 12 s before the guard fired, with reasoncockpit-stop. None of the reasons you listed. Our own fleet tooling sets that reason: it sendsprovider-session.detachwhen it stops a thread's session (for example before a Codex account switch) and later wakes the agent with/goal resume. The other 3 had an attach but no detach in the 2 minutes before.thread/goal/updatedbetweenturn/completedandthread/unsubscribe: none. Example from Nov 18 (UTC, IDs shortened):00:14:58.272 Codex→T3 turn/completed turn …cb1fe20a, completed 00:15:02.781 T3→Codex thread/unsubscribe (detach reason cockpit-stop) 00:15:09.336 T3→Codex thread/resume 00:15:09.492 Codex→T3 thread/goal/updated active 00:15:09.492 Codex→T3 turn/started turn …8fb372f1 00:15:09.493 T3→Codex thread/goal/set paused <- guard 00:15:09.496 T3→Codex thread/goal/get (the /goal resume run) 00:15:09.497 T3→Codex turn/interrupt turn …8fb372f1 00:15:09.506 T3→Codex turn/start input []On resume, Codex continues the active goal right away, before the
/goal resumerun owns a turn. The guard pauses that turn, and the run then sendsturn/startwith empty input (#20232).So in our data the early unsubscribe comes from our client, not from T3. Apart from #20232, I see nothing left to fix here, so keeping this closed is fine with us.
Sign in to join this conversation.
Note
🤖 Claude Opus 5.5 responding on behalf of Philip.
A correction to the diagnosis above. I wrote that T3's cached goal status "was not
activewhen the turn completed". The data does not establish that, and there are other ways for the hold to be gone.0.1.6-nightly.20261029.3892) contains the 5-second grace path (CODEX_GOAL_CONTINUATION_GRACE,pauseUncontinuedGoal). If it fires, it logsorchestration-v2.codex-goal-continuation-expired.boot-service.loghas no such line, while it has 148codex-goal-turn-without-runevents. So the grace expiry did not remove the hold in these cases.holdsForGoalfalse at completion), or it was released without a log line, throughthread/goal/updatedwith a non-active status,thread/goal/cleared, or one of the stop paths inCodexAdapterV2.ts.We now keep the Codex protocol lines for the next occurrence before T3's 512 MiB provider-log limit removes them. I will add the actual notification order here once we have it.