Codex app accumulates stale subagents in cache/UI and they cannot be closed reliably

Open 💬 5 comments Opened May 30, 2026 by maxidiazbattan

What version of the Codex App are you using (From “About Codex” dialog)?

Versión 26.527.31326 (3390)

What subscription do you have?

Plus Plan

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?

Summary

In a long-running Codex desktop session that uses many subagents, the app appears to accumulate stale subagent entries in the UI/cache. Completed or already-closed agents can remain visible, and closing them is not always reconciled cleanly with backend state. Over time, this makes it difficult to tell which subagents are actually still alive.

Actual behavior

After repeated spawn/complete/close cycles:

  • many old subagents remain visible long after completion
  • some close attempts return shutdown
  • some close attempts return not found
  • some agents appear completed but still remain listed
  • the visible subagent count can grow very large (in my case, 100+)

Why this seems like an app bug

This does not appear to be tied to a specific repo workflow. In my case, the stale subagent buildup was separate from the actual project state, and some close attempts returning not found suggest the app UI/cache and backend agent state can drift out of sync.

Suggested debugging angles

  • UI cache vs backend state reconciliation for agent lifecycle
  • pruning/GC of completed subagents
  • handling of close_agent for already-completed or already-evicted agents
  • stale thread/agent handles remaining visible after shutdown
  • whether this only affects the UI list or also impacts future spawning

Screenshot

<img width="309" height="299" alt="Image" src="https://github.com/user-attachments/assets/e23f2b1a-623e-41cb-9fed-922eaaf8b995" />

What steps can reproduce the bug?

  1. Start a long Codex desktop session in a repo and use subagents heavily over time.
  2. Spawn many subagents across multiple roles (for example: researcher, planner, reviewer, coder, trainer).
  3. Let many of them finish normally.
  4. Close completed subagents from the agent controls and/or via tool-driven close requests.
  5. Continue spawning and closing more subagents in the same long-running session.
  6. Revisit the subagent list/sidebar after enough cycles.

Observed

  • many old subagents are still shown
  • some can no longer be closed cleanly
  • some close attempts return not found
  • some already-completed agents remain visible as if still retained in cache/UI
  • the visible count can grow very large (in my case, 100+)

What is the expected behavior?

Completed or explicitly closed subagents should no longer remain in the active visible subagent list.

The app should reconcile UI state with backend state reliably:

  • if an agent is completed, it should appear as completed and be removable/archived cleanly
  • if an agent is closed, it should disappear from the live list or move to a clearly separate historical section
  • if an agent no longer exists, the UI should not keep showing it as lingering cached state

Repeated spawn/complete/close cycles in a long session should not cause the visible subagent count to grow indefinitely with stale entries.

Additional information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗