Closed subagents remain in sidebar until threads are archived

Open 💬 2 comments Opened Jul 2, 2026 by kennyalive

Me: the following issue description is generated by Codex. There was UI issue and codex fixed it by digging into internal. I have the latest codex version as of July 2nd 2026.

Summary

Closed subagents stayed visible in the Codex sidebar and the subagent count kept growing (Show 148 more). close_agent succeeded for individual agents, but the sidebar still listed them.

Local findings

In ~/.codex/state_5.sqlite:

  • thread_spawn_edges had 154 child threads for the workspace
  • 150 edges were already closed
  • 4 edges were stale open entries, but close_agent reported those ids as not found
  • all 154 corresponding threads rows had archived = 0

So the sidebar appears to count unarchived child threads, not just live subagent workers.

Workaround used

I backed up state_5.sqlite, then archived only the affected workspace's child threads and marked stale edges closed. After that:

  • remaining_unarchived_children = 0
  • remaining_nonclosed_edges = 0

Expected behavior

When a subagent is closed/completed, it should not keep accumulating in the sidebar indefinitely. There should also be a supported bulk cleanup/archive path for completed subagents.

View original on GitHub ↗

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