Codex desktop rehydrates closed, terminal subagents as Working after restart

Open
#37,563 15 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust, sqlite
Domain
desktop

Research direction

Start with the Subagents panel rehydration path and the persisted thread_spawn_edges state. Run the provided sqlite3 query and inspect how task_complete, turn_aborted, and closed records are handled during restart. Done means terminal historical children remain completed or aborted and are not shown as Working after rehydration.

Written by the indexing model from the issue text.

Description

app bug subagent

Summary

Codex desktop 26.803.41515 (build 6321, Chromium 151.0.7922.76) incorrectly rehydrates completed and aborted subagents as Working after application startup.

The affected sessions are not live. Every inspected child rollout has a terminal event, every persisted spawn edge is closed, and backend lookup returns not_found. The Subagents panel nevertheless reconstructs historical children as active, including elapsed times of several days.

Impact

  • False active-agent counts across affected parent conversations.
  • Users cannot determine whether background work actually exists.
  • Completed agents appear to be running for days.
  • The panel may introduce UI/session-loading overhead when many historical children are reconstructed.

Evidence

  • Historical child sessions inspected: 516
  • Parent conversations affected: 11
  • Terminal rollout events:
    • task_complete: 469
    • turn_aborted: 47
    • Missing terminal events: 0
  • Persisted thread_spawn_edges state:
    • closed: 516
    • open: 0
  • SQLite integrity check: ok
  • Backend lookup of affected historical agents: not_found
  • One affected conversation (“Oanda”): 76 recorded subagents; all 76 end with task_complete; the UI still shows them as working.

Reproduction

  1. Use a conversation that previously spawned many subagents and let them complete or abort.
  2. Open the Subagents panel. Completed children may be shown as Working, with long elapsed times.
  3. Quit and restart Codex desktop.
  4. Reopen the same conversation.
  5. The same terminal historical children are rehydrated as active.
  6. Compare persisted edge state:
sqlite3 ~/.codex/state_5.sqlite \
  "SELECT status, COUNT(*) FROM thread_spawn_edges GROUP BY status;"

Expected result for the affected data: all records are closed. The UI still reports the agents as working.

Expected behaviour

On rehydration, the Subagents panel should honour terminal child rollout events (task_complete / turn_aborted) and the persisted thread_spawn_edges.status = closed state. Historical child-session existence alone must not imply a live working agent.

Actual behaviour

The desktop UI appears to infer Working from a historical subagent session or spawn record, ignoring terminal and closed state.

Additional observation

Resuming one representative stale child and explicitly closing it produced a shutdown notification. This suggests the live UI understands an explicit shutdown transition but fails to recognise already-terminal historical sessions during startup.

Scope and safety

This report is diagnostic only. No project files, databases, caches, conversations, or project artefacts were changed during investigation.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.