Codex Desktop rehydrates nonexistent historical subagents as active whenever an affected task is opened
Summary
On Codex Desktop for macOS, opening an affected long-running task causes many historical child agents to be displayed again as Working (作業中). This happens every time the task is opened.
Attempts to stop or close the displayed agents return thread ... not found, so the visible active state and the lifecycle/control API disagree. Updating Codex Desktop, restarting the app, and rebooting macOS do not clear the condition. The same symptom has occurred in at least two independent long-running tasks.
This is not just a cosmetic stale badge: the user cannot determine whether agents are actually running, whether resources are still being consumed, or whether stop controls have taken effect. Multi-agent use has therefore been disabled for the affected workflows.
Environment
- Product: Codex Desktop app for macOS
- App version:
26.730.61639(build6234) - Bundled CLI:
codex-cli 0.147.0-alpha.1.2 - OS:
macOS 26.5.2(build25F84) - Architecture:
arm64 - Affected scope: at least two independent, long-running project tasks
Steps to reproduce
The problem is reliable for the affected tasks, although I do not yet have a small fresh-task reproducer.
- Open an affected long-running task in Codex Desktop.
- Observe the Subagents panel.
- Many historical subagents immediately appear as
Working, including repeated historical names. - Attempt to stop/close the displayed agents.
- Observe that the control operation returns errors equivalent to:
``text``
thread <id> not found
- Leave and reopen the same task.
- Observe that the historical agents are shown as
Workingagain. - Restart Codex Desktop, or reboot macOS and reopen the task.
- Observe that the condition returns.
The same pattern has been observed in another independent long-running project task on the same Mac.
Actual behavior
- Merely opening the affected task rehydrates many historical/nonexistent child agents into a visible
Workingstate. - Stop/close operations cannot resolve them because the corresponding thread is
not found. - App restart, app update, and full OS reboot do not repair the task state.
- The UI does not distinguish actually running agents from stale historical entries or non-resolvable lifecycle records.
- The user has no trustworthy way to know whether work or resource consumption continues.
Expected behavior
- Loading a task must preserve terminal child-agent states.
- A nonexistent or already-closed child must never be displayed as active.
- The UI and runtime API must agree on lifecycle state.
- Stop/close should be idempotent and return a terminal result such as
already closed; not activerather than leaving an active badge behind. - The app should distinguish at least
active,completed/retained, andstale/non-resolvablestates. - A task-level
resync/repair agent stateaction should be available when local UI state and backend lifecycle state diverge.
Persistence and recovery attempts
The following did not resolve the issue:
- Stopping the displayed agents individually.
- Leaving and reopening the affected task.
- Restarting Codex Desktop.
- Updating Codex Desktop to the version listed above.
- Rebooting macOS.
Sanitized diagnostic observations
- One affected long-running task had approximately
151historical child-session records during local reconciliation. - Stop/close attempts against those historical entries returned
not_found. - The corresponding parent rollout/history was unusually large (approximately
17 GB). This is included as a possible trigger or stress factor, not as a claimed root cause. - The visible trigger is task loading: opening the affected task causes the stale
Workingstates to appear again. - Because the tasks contain confidential project data, raw rollout files and uncropped screenshots are not attached. Sanitized screenshots limited to the Subagents panel can be provided.
These observations support a task-load rehydration or lifecycle-state reconciliation defect. They do not prove that 151 agents are actually executing.
Impact
- The execution state shown by the primary control surface cannot be trusted.
- Stop/cancel effectiveness cannot be verified.
- Users cannot safely distinguish active work from stale UI state.
- Multi-agent workflows become unusable for long-running tasks.
- Users are forced to migrate work to a new task and avoid subagents, losing continuity and parallelism.
- For confidential or state-changing workflows, ambiguous invisible execution is a safety and governance concern.
Related issues
- #23219: shutdown/nonexistent subagents appear to count toward the thread limit;
close_agentreturnsnot found - https://github.com/openai/codex/issues/23219
- #19197: persistent orphaned subagents and missing lifecycle controls
- https://github.com/openai/codex/issues/19197
- #24287: Codex Desktop UI/backend active-state desynchronization and unreliable Stop behavior
- https://github.com/openai/codex/issues/24287
- #14866: completed subagents remain stale in the UI
- https://github.com/openai/codex/issues/14866
This report adds a current macOS/Desktop regression pattern: the issue survives application update and OS reboot, affects multiple tasks, and is re-triggered every time the affected task is opened.
Suggested fix direction
- On task load, reconcile child-agent UI state against authoritative runtime state before showing
Working. - Never infer active state from historical spawn records alone.
- Make stop/close idempotent and return authoritative
active,already terminal, orunknown/stalestatus. - Add
counts_toward_limitandlast_authoritative_state_atfields to agent diagnostics. - Add an in-app repair/resync action for corrupted or stale agent-state projections.
- Add regression coverage for long histories, app restart, OS reboot, and repeated task reopen.
Additional information available on request
- Cropped screenshots showing only the Subagents panel
- Approximate timestamps of app restart/reboot/reopen reproduction
- A redacted list of lifecycle control results
- Sanitized state summaries that exclude project names, prompts, file paths, and document contents
7 Comments
Additional reproducible datapoint from Codex Desktop on Linux. This is the second occurrence for this user/task workflow.
Environment:
Observed on 2026-08-08 (Asia/Kolkata):
is working.close_agentcalls whose returnedprevious_statuswascompletedfor these agents.close_agentagainst all 18 IDs now returnsagent with id ... not foundfromcodex_core::tools::router.Impact:
This Linux recurrence supports the issue's proposed root cause: parent-task restoration is rendering historical spawn/session records as active without reconciling them against terminal rollout events or the live agent registry.
Additional requested diagnostics can be provided in sanitized form. The affected project contents and prompts are private and are intentionally omitted.
The cross-platform recurrence makes this look like a restoration contract problem rather than a renderer-only cache bug.
I would treat every persisted child-agent row on task load as historical evidence to reconcile, not as a liveness record that can be replayed directly into
Working.A child can carry separate fields such as:
Then task restoration can use a monotonic rule:
That is important because historical
spawnedges are append-only facts: they prove the child once existed, not that it is executing now. A reboot cannot make that old fact current again.The existing
close_agent -> not foundresult is also useful reconciliation evidence.closeshould be idempotent at the control-plane level: if the live registry has no child and durable history already shows terminal completion, returnalready_terminaland repair the projection rather than leaving aWorkingbadge.I would add one recovery fixture built from the reported sequence:
and the corruption twin:
The invariant is: task restoration may reconstruct history, but only current runtime evidence may reconstruct liveness.
Still issue alive in desktop app 26.803.5235.0 (win11pro fully updated)
workaroudn: select one by time, waiting the sync, go abck and the subagent go back "done"
Really, last update made things worst :D
<img width="302" height="70" alt="Image" src="https://github.com/user-attachments/assets/17a2cec1-4b0e-42be-be8a-95f658762c2e" />
This reopen-triggered rehydration also reproduced on Windows: children with terminal task_complete rollouts and no live handles returned to Active after the parent was opened again. Opening a child forced a one-by-one refresh; restart did not repair the projection. This links directly to #37042, #37563, and the stale-handle report in #23930.
Additional macOS reproduction observed on 2026-08-26:
/root/fix_keyboard_navigation,/root/workbench_roving_focus, and/root/issue21_implementation_retryreturnednot_found.Fix selector dynamic asset loading,Scope vehicle selector asset, andInvoice dropdown offset.This strengthens the task-rehydration/state-reconciliation diagnosis: restart does not merely preserve stale classifications; it can reclassify additional completed agents as active and reduce the Done count. The UI therefore cannot be used to determine whether model usage or concurrency is still active.
Two cropped screenshots containing only the Subagents panel are available if maintainers need them.
Update (2026-08-26, Windows/MSIX): the load-time rehydration pattern is reproducible on Codex Desktop 26.820.7780.0 (x64) with bundled CLI codex-cli 0.150.0-alpha.8.
After completed child agents were cleaned/closed, the UI initially looked clear. After the app ran for some time and the affected parent chat was reopened, historical children reappeared as Active/Working. A read-only audit showed no live child handles, but 172 persisted child rows (171 normally completed, 1 incomplete), stale thread-history activity, 452 rollout ordinal gaps, and projection cursors that lagged far behind the corresponding rollout ends. The rollout JSONL files were still present, so this is not confirmed message deletion; the history materializer is failing to advance and task load rehydrates stale activity as active.
Reproduction: spawn children, let them complete, close/reopen Codex, wait for background materialization, then reopen the same long-running parent task and inspect Subagents. The stale rows return. This reproduces the lifecycle/state-projection divergence on current Windows. No private project data is attached.