Codex Desktop accepts prompt but UI stays stuck in Thinking; Stop fails and turn can become invisible after restart
What version of the Codex App are you using (From “About Codex” dialog)?
Codex Desktop 26.519.41501 (CFBundleVersion 3044)
What subscription do you have?
ChatGPT Pro
What platform is your computer?
macOS 15.6.1 build 24G90
arm64
Apple M1 Max
64 GB RAM
Local app/runtime details observed from the installed app and local Sentry scope:
Bundle id: com.openai.codex
Electron: 42.1.0
Chrome runtime: 148.0.7778.97
Sentry release: [email protected]
What issue are you seeing?
Codex Desktop intermittently accepts prompts and continues executing backend work, but the Desktop UI loses reliable active-turn/session state. The visible chat can get stuck in Thinking, stop showing progress traces, show stale or missing turn state, or disagree with other UI surfaces about whether work is active.
I would consider this a major/critical issue, not a cosmetic UI bug, because the Desktop UI is the primary observability and control surface for active Codex execution. If trace visibility, active-turn state, and Stop/cancel state desynchronize, the user loses reliable control over active background work.
Important clarification: I have not observed an app crash, renderer crash, or automatic reload before this happens. The app can remain open. The issue appears to be that the renderer-visible session/turn/trace state becomes detached, stale, frozen, missing, or incompletely rehydrated while backend work may still be running.
The core bug:
- the session/turn appears active or was already visibly active;
- the UI can be stuck on
Thinking; - the prompt bar may show an active turn with the Stop button, or in some
/goalcases may incorrectly show Send while the goal bar still says the goal is actively pursuing; - no new progress traces appear, even while usage may continue decreasing;
- Stop may be unavailable, misleading, or unresponsive;
- the UI does not reliably reflect what the backend is actually doing.
This has happened intermittently for roughly a month. It appears random, but it may be more likely with long-running sessions/threads, trace-heavy turns, subagents/tools, compaction, multi-window use, /goal, or after a relogin/auth flow while the app remains open.
Observed failure modes
1. Prompt accepted, UI stuck in Thinking, Stop fails
Basic pattern:
- I send a prompt.
- The UI stays stuck on
Thinking. - Pressing Stop does not stop the turn.
- I am forced to quit/restart Codex Desktop manually.
- After restart, the thread can look like my prompt was never sent, or it can show later assistant progress without showing the prompt and/or traces that happened while the UI was stuck.
- Because the UI makes it look like the prompt was not accepted, I may resend the prompt.
- Later recovered state proves the original prompt was accepted and the backend/agent had been working the whole time.
- In previous occurrences, trying to recover by resending the prompt or forking the chat has produced errors along the lines of
cannot find session/ missing session.
2. Live trace/progress stream disappears
When this bug happens, it is not only the final assistant message or prompt bubble that can be affected. The live trace/progress stream itself can disappear.
Observed variants:
- stuck
Thinkingwith no traces shown, even though backend work appears to continue; - restart can remove traces that were previously visible;
- for long tasks, the trace stream can randomly reattach later without restart;
- sending a follow-up prompt has sometimes appeared to unstick/reconnect the trace stream.
3. /goal state split and multi-window rehydration failure
This also appears associated with the /goal feature, and the order of events matters.
Corrected repro order from one occurrence:
- I had already started the goal via a prompt in the original window.
- The goal was working normally.
- The original session UI was showing the prompt/goal progress traces normally.
- The prompt box was correctly showing the Stop button, indicating an active turn was running.
- Only after that, I tried opening the same session in a new Codex window.
- In the new window, the session failed to load or did not finish loading the active session state.
- At that point, the already-visible goal/prompt progress traces disappeared in both the new window and the original window.
- Both windows then looked as if the active turn/progress had been lost in the chat/trace area, and the prompt box showed Send instead of Stop. However, the goal bar above the prompt box still showed the goal as actively pursuing, not paused or stopped.
- After waiting some time, all of the traces that had previously been visible spontaneously appeared again, and the prompt box changed back to Stop.
This is different from the UI simply failing to show traces from the beginning. The traces and active Stop state were visible and working first. Opening the same session in a second window appears to have caused the Desktop UI to lose or detach the already-visible active turn/session state across all windows.
The especially strange part is that different parts of the same UI disagreed about whether work was active: the goal bar still showed an active pursuing-goal state, while the chat/trace area lost the active progress and the prompt box reverted to Send. That suggests a session/turn state split between the goal-level active state and the visible turn/trace/input state.
4. Multi-window active-session monitoring can freeze/detach visible progress across sessions
This is especially concerning when trying to monitor multiple active Codex sessions at once. My goal was to open each active session in its own Desktop window so I could watch each one progress, instead of manually switching between sessions inside a single window.
Observed behavior:
- one existing window/session had been showing the active turn's persisted traces/progress correctly;
- after trying to open active sessions in new windows, one of the windows hit the session loading/rehydration issue;
- after that, visible progress across the sessions/windows appeared to become frozen or detached;
- all of the sessions I had opened in new windows stopped showing new traces;
- the backend presumably continued working in the background, but the Desktop UI stopped showing new trace/progress updates;
- this makes the UI unreliable as a monitor for active work, because it can show no progress even while work may still be running.
This may be connected to very long sessions/threads. These sessions are long-running and trace-heavy, and it is starting to look possible that the app is failing to consistently load or rehydrate long session state unless I completely quit and restart the app.
5. Confirmed active backend usage while UI is frozen
This now appears confirmed as active backend execution with a frozen/detached Desktop UI.
Across multiple active sessions:
- the UI shows the sessions as
Thinking; - the prompt box shows the Stop button, indicating an active turn;
- no new progress traces or activity are visible in the app;
- the visible state appears frozen;
- however, my usage dashboard is actively decreasing while this is happening.
That strongly indicates Codex is still executing and using model resources in the background, but the Desktop app is not showing any of the activity, traces, or progress. The issue is not simply that the model stopped or that the turn is idle. The backend appears active while the UI is detached from the running turn state.
Concrete evidence from one occurrence
After restart/recovery, the visible history showed that the original stuck turn had actually continued doing work. It showed status/progress like:
Steered conversation
The previous commit-boundary reviewer handle is not available in this resumed tool session, so there’s no valid approval artifact to consume. A new prompt delta just arrived too; I’m checking it against the already registered EK-DOCS-SYNC delta before I touch any gate state.
Explored 1 file, ran 2 commands
The repeated EK-DOCS-SYNC directive is already represented in the repo-local prompt-delta artifact and successor proof: full docs-state backfill, coverage matrix, canonical docs, and explicit forbidden actions are all present. I’m going to have the commit-boundary reviewer independently verify that duplicate/newest prompt is covered before approving the commit boundary.
Spawned 1 agent
Ran 3 commands
The reviewer is running while I keep my side read-only. One local inspection hit a harmless parsing assumption in VALIDATION.json; I’m not treating that as a repo failure, just as a cue to use the file’s actual schema when refreshing validation later.
The independent commit-boundary gate is approved with no findings, including the repeated EK-DOCS-SYNC directive check. I’m closing that reviewer and recording the gate outcome into repo-local artifacts/state before moving to commit approval.
From the user perspective before the manual restart, the app was simply stuck in Thinking, Stop did not work, and I could not see that work. I resent the prompt because the UI made it appear as if the prompt had not been sent.
Impact
- Active agent work may continue while the UI appears frozen, stale, or detached. Usage can continue decreasing while no traces/progress are visible.
- The user cannot reliably observe what Codex is doing.
- The user cannot reliably determine whether a turn is active, stopped, detached, or invisible.
- Stop/cancel may be unavailable, misleading, or unresponsive.
- The visible chat history can be misleading after restart.
- Duplicate prompts can be created because the original prompt is hidden or appears unsent.
- Resend/fork recovery paths can hit missing-session style errors.
- Long-running workflows with subagents/tooling can be duplicated, conflicted, or left running invisibly.
- Multi-window monitoring of active sessions becomes unreliable because opening/loading one session can appear to freeze or detach visible progress across windows.
For an agentic desktop app that can run tools, spawn agents, and work on repositories, reliable active-turn state, trace visibility, and cancellation are core safety/control surfaces. If those desynchronize, the app becomes unsafe/unreliable for serious long-running work.
What steps can reproduce the bug?
I do not have a deterministic repro yet. Observed patterns:
Basic stuck Thinking / invisible turn path
- Use Codex Desktop on macOS during a long-running local workspace thread.
- Keep the app open. In some cases this may happen after a relogin/auth flow.
- Send a prompt.
- The UI remains stuck on
Thinkingafter the prompt. - Try pressing Stop. It does not stop the turn.
- Manually quit/restart Codex Desktop.
- Reopen the thread.
- The prompt/trace may be missing or partially recovered, even though later state shows the agent had been executing the prompt.
- If the prompt is resent because it looks unsent, it may later appear as a steered/duplicate continuation, or recovery actions like forking can hit missing-session errors.
/goal / second-window rehydration path
- Start a
/goalturn via prompt. - Let it run normally in the original window.
- Confirm traces/progress are visible and the prompt box shows Stop.
- Open the same session in a new Codex Desktop window.
- The new window fails to load or does not finish loading the active session state.
- Already-visible traces disappear in both windows.
- The goal bar still shows actively pursuing, but chat/trace state disappears and the prompt box may show Send instead of Stop.
- After waiting, traces may spontaneously reappear and the prompt box may return to Stop.
Multi-window active-session monitoring path
- Have multiple long-running active sessions.
- Open each session in its own Desktop window to monitor progress.
- One or more windows fail to load/rehydrate active session state completely.
- Visible progress traces across sessions/windows stop updating or appear frozen/detached.
- Backend work may still be running, but the UI no longer reliably shows progression.
Local state observations
Sanitized local state observations from the same app session:
- Local Sentry scope had active app-state snapshots during the session.
- Breadcrumb counts included:
method=turn/start: 2method=turn/steer: 1Item not found in turn state: 2app_state_snapshot: 26
- App-state snapshots repeatedly included active/streaming mismatch indicators:
thread_count_active: 4thread_count_streaming_owner: 3thread_count_streaming_without_role: 1thread_count_streaming_without_active_runtime: 2-3thread_count_with_inflight_turn: 1-2inflight_turn_count: 1-2browser_use_active_turn_route_count: 1-2
I am not claiming this is the same as reports involving a confirmed crash/reload, placeholder rebinding, or thousands of Item not found in turn state errors. The observed user-facing bug here is: prompt accepted and executed, UI stuck in Thinking or active-turn state becomes detached/frozen, Stop/Send state becomes misleading, and visible prompt/trace/session state is missing or misleading until restart or later rehydration.
What is the expected behavior?
If Codex Desktop accepts a prompt or continues a goal, it should durably and visibly associate that backend turn with the originating thread/session across windows.
Expected behavior:
- The user prompt should remain visible after submission.
- Assistant progress, tool calls, subagent activity, and traces should stream reliably while work is active.
- Active turn state should be consistent between the goal bar, chat/trace area, and prompt box.
- Opening the same session in another window should not detach or clear traces in the original window.
- Opening multiple active sessions in separate windows should not freeze visible progress streams across sessions.
- Stop should reliably cancel the backend turn or show why it cannot.
- If the renderer/thread UI loses ownership of an active backend turn, the app should show a recovery/reattach state instead of generic stuck
Thinkingor misleading Send/Stop state. - Resending or forking should not produce missing-session errors or duplicate/steered turns because of hidden accepted prompts.
- Long sessions should either load/rehydrate reliably or show an explicit loading/recovery state that does not erase visible active traces.
Additional information
This seems like a session/turn state ownership or trace-stream subscription problem between the Desktop UI and the backend/app-server. The backend appears to accept and execute prompts, but the UI can fail to show the submitted prompt, active stream, tool traces, goal/turn alignment, and cancellation state.
The main issue is not one exact repro path. It shows up through /goal, multi-window session opening, long-running turns, restarts, and sometimes follow-up prompts. The common failure is that the Desktop UI does not reliably and consistently show the real active state, progress, and trace stream for running sessions, especially long sessions.
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #24263
- #24217
- #23292
Powered by Codex Action
Additional detail about the visible trace/progress stream:
When this bug happens, it is not only the final assistant message or prompt bubble that can be affected. The live trace/progress stream itself can disappear.
Observed variants:
-
Stuck
Thinkingwith no traces shownSometimes after I send a prompt, the UI gets stuck on
Thinkingand none of the traces/steps/progress are shown, even though the backend appears to be working. -
Restart can remove traces that were previously visible
After manually quitting/restarting the app, the reopened thread can be missing parts of the thread that were previously present. In particular, if I send a prompt during an active turn and the app bugs out, then after restart the entire previous turn's traces can be gone from the visible UI.
-
Trace stream can randomly reattach later without restart
For long tasks, Codex normally shows progress/traces continuously during the turn. When the bug happens, it may show only
Thinkingand nothing afterward for a long time. If I wait an extended time, the UI can randomly resume showing traces again before the turn finishes. -
Follow-up prompt can sometimes unstick the trace stream
In at least one occurrence, I sent another follow-up prompt while it was stuck, and that appeared to unstick the UI: the thinking/progress traces started showing again.
This makes the bug feel like a live turn trace/session subscription or ownership desync. The backend work can continue, but the renderer-visible thread can stop receiving or rendering the active turn's trace events. Later, the UI may reattach spontaneously or after another prompt, but restart can also cause previously visible traces to disappear from the reconstructed thread view.
This is essentially the same thing I'm seeing in my issue https://github.com/openai/codex/issues/24263
title: "Codex Desktop accepts prompt but UI stays stuck in Thinking; Stop fails and turn can become invisible after restart" issue: https://github.com/openai/codex/issues/24287 repo: openai/codex type: bug-fix area: app, session, app-server competition: low (3 comments, but no solution proposed) quote: $1,500-$2,500
Complete Solution
Root Cause Analysis
This is a session/turn state ownership desync between the Codex Desktop UI (Electron renderer) and the backend/app-server. The core issue:
- Prompt accepted but UI loses ownership: The backend accepts and executes the prompt, but the UI's turn subscription fails to receive or render the prompt bubble, assistant progress, and tool traces
- Stop fails: The Stop button can't cancel because the UI doesn't have a valid reference to the active turn
- State invisible after restart: The thread's prompt/trace state is not durably associated with the originating thread, so restart shows misleading or missing history
Key evidence from Sentry breadcrumbs:
thread_count_active: 4butthread_count_streaming_owner: 3— one active thread has no streaming ownerthread_count_streaming_without_role: 1— a streaming thread has no role assignedthread_count_streaming_without_active_runtime: 2-3— streaming threads with no active runtimeItem not found in turn state: 2— turn state lookup failures
Fix — Three-Layer Approach
Layer 1 — Turn ownership reconciliation (primary fix):
// In app-server's turn management (Rust)
// When a prompt is accepted, ensure the turn is durably linked to its thread
// BEFORE any streaming begins
fn handle_prompt(thread_id: &str, prompt: Prompt) -> Result<TurnId> {
// 1. Create turn record in the thread's durable store FIRST
let turn = Turn::new(thread_id, prompt);
self.store.save_turn(&turn)?; // Durable write before streaming
// 2. THEN start the backend execution
let turn_id = turn.id.clone();
self.backend.execute(turn_id.clone(), prompt);
// 3. Subscribe the UI to the turn stream
self.ui.subscribe(thread_id, turn_id.clone());
Ok(turn_id)
}
Layer 2 — Stop/cancel reliability:
// In the Desktop UI's Stop handler
async handleStop() {
// Get the current turn_id from the durable store, not just in-memory state
const turnId = await this.store.getActiveTurnId(this.threadId);
if (!turnId) {
// Show recovery UI instead of silently failing
this.showRecoveryState("No active turn found. Checking backend state...");
const backendTurn = await this.appServer.findActiveTurn(this.threadId);
if (backendTurn) {
// Re-attach UI to the backend turn
await this.reattachToTurn(backendTurn);
}
return;
}
await this.appServer.cancelTurn(turnId);
}
Layer 3 — Recovery/reattach state:
// When the UI detects it has lost ownership of an active turn
async detectAndRecover() {
const localActive = await this.store.getActiveTurns(this.threadId);
const backendActive = await this.appServer.getActiveTurns(this.threadId);
// Find turns that exist in backend but not in UI
const orphanedTurns = backendActive.filter(
bt => !localActive.some(lt => lt.id === bt.id)
);
for (const orphaned of orphanedTurns) {
// Show a recovery banner
this.showRecoveryBanner({
type: 'orphaned_turn',
turnId: orphaned.id,
message: 'An active turn was found that is not visible in the UI. Click to re-attach.',
action: () => this.reattachToTurn(orphaned)
});
}
}
Testing Strategy
- Unit test: verify turn is durably stored before streaming begins
- Integration test: simulate UI crash during active turn, verify recovery on restart
- Edge case: verify Stop works even when UI has lost turn ownership
- Regression test: verify normal turn flow (prompt → stream → response) is unaffected
Files to Change
codex-rs/app-server-daemon/src/turn_manager.rs— add durable turn storage before streamingapp/src/turn-state-manager.ts— add recovery/reattach logicapp/src/stop-handler.ts— use durable turn reference instead of in-memory
Impact
- Prompts are durably associated with their originating thread
- Stop button reliably cancels the backend turn or shows recovery state
- Orphaned turns are detected and recoverable after restart
- No duplicate prompts from invisible accepted prompts
Additional detail: this also appears associated with the /goal feature, and the order of events matters.
Corrected repro order:
- I had already started the goal via a prompt in the original window.
- The goal was working normally.
- The original session UI was showing the prompt/goal progress traces normally.
- The prompt box was correctly showing the Stop button, indicating an active turn was running.
- Only after that, I tried opening the same session in a new Codex window.
- In the new window, the session failed to load or did not finish loading the active session state.
- At that point, the already-visible goal/prompt progress traces disappeared in both the new window and the original window.
- Both windows then looked as if the active turn/progress had been lost in the chat/trace area, and the prompt box showed Send instead of Stop. However, the goal bar above the prompt box still showed the goal as actively pursuing, not paused or stopped.
- After waiting some time, all of the traces that had previously been visible spontaneously appeared again, and the prompt box changed back to Stop.
This is different from the UI simply failing to show traces from the beginning. The traces and active Stop state were visible and working first. Opening the same session in a second window appears to have caused the desktop UI to lose or detach the already-visible active turn/session state across all windows.
The especially strange part is that different parts of the same UI disagreed about whether work was active: the goal bar still showed an active pursuing-goal state, while the chat/trace area lost the active progress and the prompt box reverted to Send. That suggests a session/turn state split between the goal-level active state and the visible turn/trace/input state.
That makes the session state shown in the UI feel temporary or incompletely rehydrated: the persisted/streaming state seems to disappear from the renderer until whatever session/turn binding or trace stream loading finishes again. When it reattaches, the missing traces reappear as if they had been there the whole time.
This still does not look like an app crash. The app remains open. The visible session state becomes inconsistent across windows, then later rehydrates.
Additional impact / multi-window observation:
This is especially concerning when trying to monitor multiple active Codex sessions at once. My goal was to open each active session in its own Desktop window so I could watch each one progress, instead of manually switching between sessions inside a single window.
What I observed:
- one existing window/session had been showing the active turn's persisted traces/progress correctly;
- after trying to open active sessions in new windows, one of the windows hit the session loading/rehydration issue;
- after that, visible progress across the sessions/windows appeared to become frozen or detached;
- I could no longer reliably see further progress traces in the UI;
- the backend presumably continued working in the background, but the Desktop UI stopped showing new trace/progress updates;
- this makes the UI unreliable as a monitor for active work, because it can show no progress even while work may still be running.
This may be connected to very long sessions/threads. These sessions are long-running and trace-heavy, and it is starting to look possible that the app is failing to consistently load or rehydrate long session state unless I completely quit and restart the app.
The concerning failure mode is: opening the same or other active sessions in additional windows can appear to detach or freeze the visible active-turn state across windows, leaving the user unable to tell what is currently running or whether Stop would work.
Core failure mode clarification:
As of now, all of the sessions I opened in new windows are no longer showing any new traces. This is the main problem behind the different variants I have described.
The core bug is:
- the session/turn appears active;
- the UI can be stuck on
Thinking; - the prompt bar may show an active turn with the Stop button;
- but no new progress traces appear;
- the UI does not reliably respond or reflect what the backend is actually doing.
So the issue is broader than one exact repro path. It shows up through /goal, multi-window session opening, long-running turns, restarts, and sometimes follow-up prompts, but the common failure is that the Desktop UI does not reliably and consistently show the real active state, progress, and trace stream for running sessions, especially long sessions.
In other words: the app can have an active backend turn, but the renderer-visible session state/trace stream becomes detached, frozen, missing, or stale. That makes the app UI unreliable for monitoring active Codex work and for knowing whether Stop will actually work.
Severity note:
I would consider this a major/critical issue, not a cosmetic UI bug.
Reason: the Desktop UI is the user's primary control and observability surface for active Codex execution. When it stops showing real progress traces, shows inconsistent active state, or leaves the user unsure whether Stop will work, the user loses reliable control over active background work.
Impact:
- active agent work may continue while the UI appears frozen or stale;
- the user cannot reliably observe what Codex is doing;
- the user cannot reliably determine whether a turn is active, stopped, or detached;
- the Stop control may be unavailable, misleading, or unresponsive;
- users may resend prompts or open/fork sessions because the UI makes the active state unclear;
- long-running repo workflows can be duplicated, conflicted, or left running invisibly.
For an agentic desktop app that can run tools, spawn agents, and work on repositories, reliable active-turn state, trace visibility, and cancellation are core safety/control surfaces. If those desynchronize, the app becomes unsafe/unreliable for serious long-running work.
Additional confirmation: this now appears confirmed as active backend execution with a frozen/detached Desktop UI.
Across multiple active sessions:
- the UI shows the sessions as
Thinking; - the prompt box shows the Stop button, indicating an active turn;
- no new progress traces or activity are visible in the app;
- the visible state appears frozen;
- however, my usage dashboard is actively decreasing while this is happening.
That strongly indicates Codex is still executing and using model resources in the background, but the Desktop app is not showing any of the activity, traces, or progress. The issue is not simply that the model stopped or that the turn is idle. The backend appears active while the UI is detached from the running turn state.
This is the core reliability problem: active work can continue invisibly while the app UI is stuck and provides no usable observability.
I’m seeing the same failure mode on Codex Desktop as well.
In my case, the important part is that the UI appears detached from an active backend turn rather than the turn simply being idle. The thread can remain stuck on Thinking, progress traces stop updating, and Stop either does not work or does not appear to reflect the actual backend state. I have also seen cases where the prompt/turn appears missing after restart even though later state suggests the backend accepted and continued executing it.
My observed pattern:
- Codex accepts a prompt in an existing long-running thread.
- The UI stays on
Thinkingwith no new trace/progress updates. - The prompt box may still show
Stop, but pressing it does not reliably cancel the work. - Restarting the app may show missing or partial turn history.
- In some cases, usage continues decreasing while the UI shows no visible activity, which suggests backend execution is still active.
- Sending a follow-up prompt or waiting can sometimes cause the trace stream to reattach.
This is especially risky because the UI makes it unclear whether a turn is actually running, stopped, detached, or invisible. From a user-control perspective, the problematic behavior is not just stale rendering; it is loss of reliable observability and cancellation for active agent work.
I can provide app version/platform details and local diagnostics if helpful. Are there specific logs, Sentry scope values, or local state files that would be most useful to capture the next time this happens?
same here
same issue
Follow-up for this issue I can still reproduce this with:
Codex App version: 26.608.12217 Codex CLI version: 0.139.0 This still matches the same failure pattern:
UI stays in Thinking during an active turn progress/trace output is not updating reliably Stop may not appear to stop execution behavior looks stale or detached from actual backend activity
Extra context on the same stuck thread: the session was already in Plan mode before restart by Codex Desktop update. After restarting to 26.608.12217, UI now shows Plan mode as off, but the thread remains stuck in the Plan execution path and Plan mode cannot be turned off. Workaround that unblocks me: switching reasoning level and continuing there; that allowed the thread to proceed. This seems like a session/state desync, not an actual mode toggle mismatch.
Tracking this from a downstream app-server client / Codex Mobile integration because it matches the same user-visible failure mode: a submitted message can leave the client showing an active/Thinking state while the durable thread state does not reliably show the new turn.
Sanitized local signal from a recent occurrence:
- The client submit endpoint received the message and returned a new
turnIdfromturn/start. - A follow-up durable read still showed the previous latest completed turn, with no matching newly submitted turn visible.
- The local session JSONL/rollout did not contain the returned
turnIdor the client submission id after the submit response. - A local fallback cache then projected the returned
turnIdas active, which made the Mobile UI look like the session was still thinking even though persistent state had not advanced.
That makes this feel like the same class of session/turn ownership and durable-state desync described here: the user-facing client cannot safely distinguish "accepted and running" from "accepted-looking but not materialized". We have added a downstream guard that verifies the submitted turn is visible via bounded thread state before showing it as active; subscribing here for the upstream fix.
I reproduced this on Windows across the VS Code extension and Codex Desktop using the same local thread. A /goal was actively running in VS Code. After opening another chat/window and returning, both VS Code and Desktop showed stale conversation state ending several messages earlier. The goal bar still showed the goal as pursuing, but the visible turn appeared stopped. The local rollout JSONL retained the full history and continued growing, confirming that backend reasoning and tool activity were still running. At the same time, the exposed thread state reported notLoaded and the latest turn as interrupted. This suggests the rehydration/state-synchronization problem also affects cross-surface VS Code ↔ Desktop usage, not only multiple Desktop windows.
Analysis (community)
Residual analysis for #24287 (prompt accepted but UI stuck in Thinking; Stop unresponsive; turn invisible after restart) under docs/contributing.md — invitation-only. No unsolicited PR.
Root-cause hypothesis
The renderer/backend desync described here has a structural OSS contributor in codex-rs: turn-terminal events are gated behind an unbounded rollout flush, and everything downstream — the Stop reply, the agent status, and the unload GC — depends on those terminal events arriving. One stalled rollout-file write (Windows file-system filters/Defender; Windows has no file-write timeout) therefore converts a transient IO stall into a permanently stuck, unstoppable, un-GC-able thread. Verified at HEAD 4c43465133:
1. TurnComplete is emitted only after flush_rollout() — a timeout-less wait on a serial writer. In the task wrapper (codex-rs/core/src/tasks/mod.rs:402-435), task.run() completes, then line 415 does a bare sess.flush_rollout().await — no timeout, no cancellation select — and only afterwards reaches on_task_finished (:427-431), the sole production emitter of EventMsg::TurnComplete (construction at tasks/mod.rs:803-813). The flush chain bottoms out at Recorder::flush (codex-rs/rollout/src/recorder.rs:965-980), which sends RolloutCmd::Flush into a bounded 256-slot channel (recorder.rs:892) and does rx.await on a oneshot ack — again no timeout. The single serial writer (recorder.rs:899, writer loop :1774-1804) does write_all + flush per line (recorder.rs:1922-1928); tokio::fs is spawn_blocking-backed, so an OS-level write stall never returns an error — the recovery path only reacts to errors, the ack is never sent, and the wrapper parks at tasks/mod.rs:415 forever. Meanwhile events fan out persist-before-deliver (core/src/session/mod.rs:2072-2082): tool results produced before the stall reached the UI, which is exactly this issue's "tool calls visibly succeed but the turn never finishes."
2. Stop is double-blocked by the same writer. Op::Interrupt → handle_task_abort (tasks/mod.rs:880-917) cancels the token, waits a 100 ms grace (:67), aborts the wrapper handle — then, to persist the interrupted-turn marker (default-enabled), awaits flush_rollout().await again at :914 before emitting TurnAborted. Same stalled writer, same park. At the app-server layer the turn/interrupt JSON-RPC is additionally never answered immediately: the request id is pushed into pending_interrupts (app-server/src/request_processors/turn_processor.rs:1445) and Ok(None) is returned (:1460-1461); the only non-test drain sites are TurnComplete (bespoke_event_handling.rs:189) and TurnAborted (:1094), via respond_to_pending_interrupts (:1554-1568). No terminal event ⇒ the Stop request hangs forever. This queue/drain defect is distinct from the approval-oneshot freeze tracked in #32862 — different queue, different response type.
3. The stuck thread is then pinned for the whole session. With no terminal event, agent_status_from_event (core/src/agent/status.rs:6-21) never leaves Running, and the 30-minute idle-unload GC explicitly skips Running threads (app-server/src/request_processors/thread_lifecycle.rs:5, :356-359). Worse, if the core event stream ends mid-turn, the listener exit path (thread_lifecycle.rs:386-389 → thread_state.rs:134-141 clear_listener) resets the listener without draining pending_interrupts or synthesizing any terminal notification — so even a restart/reconnect of the app-server leaves the queued Stop unanswered.
4. The post-restart symptom is fully explained by OSS replay code. michaliskon's observation — "rollout JSONL retained the full history and continued growing… thread state reported notLoaded and the latest turn as interrupted" — matches: a persisted TurnAborted replays to TurnStatus::Interrupted in handle_turn_aborted (app-server-protocol/src/protocol/thread_history.rs:1204-1235), and after a full restart every persisted thread defaults to NotLoaded (thread_status.rs:366-369, 430-432). (Path note: thread_history.rs lives under app-server-protocol/src/protocol/, not app-server/src/.) The ghost-turn meanwhile can keep appending to the rollout after the "abort," matching "JSONL kept growing."
5. Adjacent, same-lifecycle (distinct defect, mentioned for triage only): if the interrupt lands while ActiveTurn{task: None} — the window between active_turn being set (tasks/mod.rs:494-507) and start_task assigning the handle — abort_all_tasks sets aborted_turn=false and emits no TurnAborted and no event at all (tasks/mod.rs:509-523); the queued interrupt reply then only resolves when the turn eventually completes. That is the "Stop press silently ignored, turn runs to completion" variant reported here.
What this analysis deliberately does NOT cover: the renderer-side subscription desync, double-window freeze, and renderer timeouts are closed Desktop Electron; the resume-side compaction growth that makes long crash-resume loops progressively worse (Legacy full-file reload + unbounded Compacted(replacement_history) accumulation) is analyzed separately in my comment on #33493 (https://github.com/openai/codex/issues/33493#issuecomment-5079148354) — linked here because long /goal sessions hit both, but the fix surface differs.
Fix outline (all OSS): (a) wrap both flush awaits (tasks/mod.rs:415, :914) in tokio::time::timeout (2–5 s); on timeout emit TurnComplete/TurnAborted anyway with a Warning event ("transcript save is lagging; retrying in background") — converts "stuck forever" into "turn ends, save retries"; (b) bound Recorder::flush itself (recorder.rs:965-980) with a timeout on rx.await, plus a writer-health watchdog that surfaces a terminal_failure when the serial writer makes no progress, so senders fail fast instead of backpressuring the whole event fanout; (c) drain pending_interrupts with an error/cancel response on listener exit and connection close, and synthesize a terminal notification (e.g. TurnStatus::Failed) when the core event stream ends mid-turn; (d) close the ActiveTurn{task: None} ghost-stop window by emitting TurnAborted (or an explicit error to queued interrupts) instead of silently dropping the abort.
Fail-first tests I'd want before any merge: (1) writer ack never arrives → TurnComplete still emits within the timeout, turn status Completed, turn/interrupt reply resolves (today: all three hang); (2) interrupt during the flush stall → TurnAborted within the timeout rather than never; (3) interrupt in the task: None window produces a visible terminal/error event, not silence; (4) listener drop with queued interrupts drains them with an error response (today: dropped). (1)–(3) are achievable with a fault-injected rollout writer; (4) is app-server-only. Happy to draft the test patch if a maintainer wants it. No unsolicited PR from me.
Additional Windows/Desktop data point (2026-08-01 JST):
- Codex Desktop version:
26.721.11231.0on Windows. - In a multi-thread project workflow, a background worker thread completed work but its terminal callback did not become visible/deliver to the coordinating thread while the target worker thread was not open.
- This was observed repeatedly: opening/focusing that exact worker task was immediately followed by the pending callback being delivered. The instruction was not resent, and no duplicate execution was observed.
- In an earlier occurrence, a standard cross-thread send remained unanswered for
24,303,264 ms. The PC had not slept, the same app-server process was still alive, and the stopped model transport count observed at that point was zero. Delivery completed immediately after Desktop/thread resume. The initial connection-loss trigger remains unverified. - This looks stronger than ordinary rendering lag because the coordinating workflow remained waiting for the callback until the target task was foregrounded, although the exact backend/renderer boundary is still unverified.
Expected behavior: a terminal callback/event should be delivered independently of whether the target thread is currently visible or focused, or the client should automatically resume/reconcile the thread without requiring UI interaction.
Temporary recovery observed locally: do not resend the instruction; foreground the exact target thread once. Fully restarting Desktop is a secondary recovery, but it risks losing visible trace continuity. I can provide sanitized timestamps/log excerpts privately if useful; no repository or conversation content is included here.
Additional sanitized diagnostic data point from a case where this affected not only the renderer, but also the thread-reading projection and subsequent model-visible context.
Environment
- Codex Desktop:
26.803.41515(build6321) - Bundled/installed CLI:
codex-cli 0.147.0 - macOS
26.5.2(build25F84), arm64 - Thread ID:
019fa27e-f0ea-7f71-9c78-de349bfd3365
Sanitized timeline (UTC)
10:39:38.241— ordinary turn A started, turn ID019feb41-aee3-7923-a41a-1249815e9d33.10:39:38.361— the user message for turn A was persisted in the rollout.10:40:12.460— context compaction occurred while turn A was active.- The compacted record had 221 replacement-history items.
- It included the active user message and a compaction summary marker.
- This was not the boot-preamble-only / empty-summary failure described in #36642.
10:40:20.843— the assistant's final answer for turn A was persisted.10:40:21.211—task_completewas persisted for turn A.10:43:57.609— ordinary follow-up turn B started, turn ID019feb45-a3e9-76e3-aa84-a0cba38f7546.10:43:58.704— the user message for turn B was persisted.10:44:04.141— an assistant commentary message for turn B was persisted.10:44:22.062—turn_abortedwas persisted for turn B.
After turn B was aborted:
- Desktop no longer displayed either the already-completed turn A or the interrupted turn B.
- A current
read_threadcall also omitted both turn IDs and jumped from an earlier completed turn to later turns. - Subsequent model-visible context behaved as if those messages had never happened; the agent could not recognize the missing question/answer until the raw rollout was inspected manually.
- Fully quitting and restarting Codex Desktop did not restore the missing turns.
- The raw rollout JSONL still contains the exact user and assistant message records,
task_completefor A, andturn_abortedfor B. - There is no
thread_rolled_backevent around this sequence.
Conversation text, repository names, and local paths are intentionally omitted.
This appears more severe than a trace-only rendering issue: an abort of the current turn seems able to make a previously completed turn disappear from the canonical thread projection used by all three consumers:
- Desktop transcript
- thread-reading API
- model-context reconstruction
The durable rollout remains intact, so the likely failure boundary is replay/indexing/canonical-turn reconstruction, possibly involving the combination of compaction inside turn A followed by aborting turn B.
Expected invariant: aborting turn B must not remove completed turn A, and UI, thread APIs, and model-visible context should converge on the durable rollout history.
This seriously hurts usability of running long-horizon tasks. I'm not sure how this has been in place for several months now?