Skip to content

VS Code reload re-adds closed subagents to the "background agents" count #31971

Open

Description

@MadMaxMangos

What version of the IDE extension are you using?

26.707.31428

What subscription do you have?

ChatGPT Pro (20x)

Which IDE are you using?

Visual Studio Code 1.128.0 (x64)

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

In a local Codex conversation that uses multiple subagents, closed/completed subagents are re-added to the composer’s “background agents” panel after reloading or restarting VS Code.

In my reproduced case, the UI displayed “33 background agents” even though the persisted state for that conversation contained:

  • 33 closed spawn edges
  • 0 open spawn edges

This makes it appear that many agents are still running. The displayed count accumulates across a long-running conversation as more agents are spawned and closed.

What steps can reproduce the bug?

  1. Open a local Codex conversation in the VS Code extension.
  2. Have Codex spawn several subagents/background agents.
  3. Allow the agents to finish and close them using close_agent.
  4. Confirm that no agents should remain active.
  5. Reload the VS Code window or close and restart VS Code.
  6. Reopen the same Codex conversation.
  7. Observe that previously closed agents reappear in the “background agents” panel and are included in its count.
  8. Repeat the spawn, close, and reload cycle; the displayed count continues accumulating historical agents.

What is the expected behavior?

Closed agents should remain closed after conversation hydration.

The “background agents” summary should count only agents that are currently active or waiting. Completed agents may remain available as conversation history, but they should not be included in a count that implies they are still running.

Additional information

Environment:

  • Codex IDE extension: 26.707.31428
  • IDE: Visual Studio Code 1.128.0 (x64)
  • Subscription: ChatGPT Pro (20x)
  • Platform: Microsoft Windows NT 10.0.26200.0 (x64)

Read-only inspection of %USERPROFILE%\.codex\state_5.sqlite confirmed that the affected parent conversation had 33 closed entries and zero open entries in thread_spawn_edges. All 33 child threads remained unarchived.

Inspection of the installed extension bundle showed that reload hydration requests unarchived subAgentThreadSpawn threads. The resulting composer summary uses the total row count, including completed rows, rather than filtering to active/waiting agents.

This strongly suggests that closed agents are hidden correctly during the live session but are reconstructed as completed background-agent rows during reload hydration.

No extension files or Codex state files were modified during this investigation.

Activity

  1. added
    extension
    on Jul 10, 2026
  2. added
    bug
    windows-os
    subagent
    on Jul 10, 2026
  3. github-actions commented on Jul 10, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextensionsubagentwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions