Repository navigation
Description
What version of the IDE extension are you using?
26.721.41059
What subscription do you have?
ChatGPT Plus
Which IDE are you using?
Visual Studio Code 1.131.0 using Remote - WSL
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
In new Codex chats opened through the VS Code extension, close_agent is missing from the callable collaboration-tool schema even though multi_agent is enabled.
The affected sessions expose:
spawn_agentfollowup_tasksend_messageinterrupt_agentlist_agentswait_agent
They do not expose close_agent.
This is partial tool exposure: multi-agent support is available, but the operation needed to close a completed subagent is missing. interrupt_agent is not a replacement because it only interrupts the agent's current turn and explicitly leaves the agent available.
The issue persists after updating the extension, completely restarting VS Code, and creating multiple brand-new chats.
What steps can reproduce the bug?
-
Enable multi-agent support in
~/.codex/config.toml:[features] multi_agent = true -
Restart VS Code and open a Git repository through Remote - WSL.
-
Open a new Codex chat and send this exact request:
Use a subagent to list the repository's top-level files. Wait for the subagent to finish, close it using close_agent, and report the lifecycle operations you performed. -
Observe that the session can access
spawn_agentandwait_agent, but cannot perform the requested cleanup becauseclose_agentis absent from its callable tool schema. The available cleanup-adjacent operation isinterrupt_agent, which interrupts the current turn but leaves the agent available.
What is the expected behavior?
With stable multi_agent enabled, every new VS Code Codex chat should receive the complete documented collaboration lifecycle, including a callable close_agent operation.
A workflow should be able to:
- spawn a child agent;
- wait for its result;
- explicitly close the child;
- verify that the child reached a terminal state and its slot was reclaimed.
If close_agent has intentionally been replaced, the extension should expose and document an equivalent finalization operation. interrupt_agent should not be treated as equivalent to lifecycle closure.
Additional information
The Codex runtime bundled with the affected extension reports:
codex-cli 0.146.0-alpha.3.1
Relevant configuration:
[features]
multi_agent = trueThe VS Code workspace is opened through Remote - WSL with Ubuntu 24.04.4 LTS. The Windows host platform is recorded in the dedicated platform field above.
Activity
KNaiFen commentedon Aug 4, 2026
codexcli 0.146 macos
no vscode, same bug
wuyak commentedon Aug 9, 2026
I can reproduce the same missing tool surface outside VS Code.
Environment:
26.803.41515(build6321)codex-cli 0.146.0The collaboration tools exposed in the session are:
spawn_agentfollowup_tasksend_messageinterrupt_agentlist_agentswait_agentThere is no
close_agent.interrupt_agentonly ends the current turn and leaves the child thread addressable, so it is not an equivalent close/retire/reclaim operation.This suggests the gap is not VS Code-specific. It would help to either expose
close_agentconsistently or document the supported idempotent replacement, with outcomes such asclosed,already_closed,still_active, andnot_found.mwcmaniac45 commentedon Aug 11, 2026
Also reproduced in the Codex-native Code-mode collaboration surface on macOS with Codex CLI 0.147.0. The parent can spawn, list, wait for, and interrupt children, but has no close_agent or documented equivalent.
Please expose the actual negotiated lifecycle capability to the parent surface: if native close is supported, provide an idempotent close operation that confirms the parent-child edge is closed; if it is unsupported, return an explicit unsupported/terminal-unclosed state so callers can halt safely rather than silently retaining concurrency. A wait timeout must not authorize closure of a nonterminal child, and archive should remain separate from lifecycle closure.
This is consistent with the tagged V1 source defining close_agent as the operation that releases completed-agent concurrency, while the observed V2-style surface provides no corresponding safe operation.
Geektrovert commentedon Aug 12, 2026
Adding some context from our side, because this has happened enough times that we finally sat down and traced it properly.
During a long multi-agent session in ChatGPT Desktop on macOS, the system ran out of application memory. The Force Quit window showed ChatGPT using 25.86 GB.
This screenshot shows the failure we hit, but it does not prove what caused all 25.86 GB of memory use.
This was not a one-off for us. We have lost work or had to stop and clean up the machine several times after long multi-agent sessions. I cannot say that every incident had exactly the same cause, but the pattern has been consistent enough—and disruptive enough—that we wanted to understand what was actually being left behind.
During the cleanup that led to this investigation, we recovered roughly 3.5 GB of disk space from agent-related processes and build state. That was a separate storage problem, but it prompted us to look more closely at the lifecycle of completed subagents.
One part of the problem was straightforward to reproduce:
interrupt_agentdid not reclaim them, which is consistent with what that operation promises to do;I do not think this explains the whole 25.86 GB incident. The root process continued to grow during the probe, so there is clearly more going on. What it does show is that completed subagents can retain a meaningful amount of memory and their MCP processes indefinitely, and that this portion can be reclaimed reliably.
I put together a local prototype of a resumable
release_agentoperation. It only releases completed or interrupted agents that have no active work or pending messages. It shuts down the resident session and MCP processes but keeps the agent’s identity and history, so a laterfollowup_taskcan reload the same agent instead of creating a new one.The current prototype is available here:
https://github.com/Geektrovert/codex/tree/fix/subagent-session-release
It is rebased onto the current
mainas of commit6b18f03bc0311ddd6069cdefb79251cdafcdc1a3. The rebased tree compiles, and its formatting and diff checks pass. I could not complete the focused test run because the cold Cargo build filled the remaining disk space. I cleared only the generated build cache afterward.I also found the earlier work around automatic idle-thread shutdown and race-safe teardown, including #31304, as well as the more recent lazy MCP startup work in #38217. The former was closed without merging, and the latter reduces startup cost but does not unload completed agents, so I am not sure which lifecycle direction the team currently prefers.
Before taking the prototype further, I would really appreciate a steer from the maintainers: does an explicit, resumable
release_agentsound like the right direction, or would you rather solve this through automatic idle cleanup or by permanently closing the parent-child relationship?There are still two concurrency edge cases I want to tighten up, and I need to complete the focused tests once there is enough build space. If this approach fits what the team has in mind, I would be happy to finish that work and open a PR if you would like me to.
CooperGarth commentedon Sep 8, 2026
Confirmed on Windows with both the standalone CLI and the executable bundled with Codex Desktop reporting codex-cli 0.153.4. This is not limited to VS Code or macOS.
Clean CLI reproduction
A fresh ephemeral CLI invocation, ignoring user configuration, still exposes only:
There is no
close_agentor documented genuine equivalent in the exposed schema.interrupt_agentexplicitly leaves the agent available for follow-up, and the wait/spawn schemas do not document automatic closure or slot release.PowerShell reproduction, run in an empty disposable directory:
Observed on 2026-09-08: exit 0, approximately 15 seconds, with the six tools above and an explicit report that no closure equivalent or slot-release guarantee is exposed. The diagnostic did not invoke any model-generated tools or create subagents. It still discovers skills despite
--ignore-user-config, so this is user-config isolation, not a claim of a completely bare installation.Separate real-run evidence
In an existing Desktop task, an explicit parallel-work request successfully created six subagents. Native history records a completed activity for each. A later read-only query of that exact parent's
thread_spawn_edgesshows all six corresponding edges stillopen; older edges for the same parent includeclosed, so the states are distinguishable.During that run the parent reported an agent-thread-limit failure when attempting another scanner, and reused an existing preparation agent instead. It explicitly stated that
close_agentwas unavailable and did not claim the completed children were closed. This establishes successful spawning plus unavailable cleanup; I am not claiming that the database edge status alone proves the precise cause of the concurrency-limit failure or any memory leak.The same missing-closure surface was explicitly reported by eight worker tasks. No database/session state was edited, no agents were interrupted to simulate closure, and no undocumented archive/unsubscribe workaround was attempted.
Requested clarification/fix
Please expose a supported, idempotent close/release operation consistently, or document the intended equivalent and its parent-child edge/concurrency-slot semantics. A completed turn and an interrupt are not currently documented as substitutes. If this is a negotiated tool-provider capability rather than a local CLI defect, please identify the supported remediation or fixed runtime version.
This report intentionally omits private task contents, source data, local paths, credentials, and parent/child identifiers.
benjaminstelzer commentedon Sep 9, 2026
The subagent documentation says that Codex can steer, stop, or close running/completed subagent threads. However, close_agent is not available in Codex’s tool list. As a result, spawned agents cannot be individually closed, and the subagent limit can be exhausted permanently within a session.
Please either expose a supported agent-lifecycle tool such as close_agent, or update the documentation to accurately describe the current limitation.
shevakuilin commentedon Sep 18, 2026
This is consistent with the observed behavior. The GPT-5.5 workflow used the older lifecycle surface containing
multi_agent_v1.close_agent, while GPT-5.6 Sol uses the V2-stylecollaborationsurface without a close operation.This also suggests that the effective tool protocol is selected through model/runtime metadata rather than only through the locally reported feature-flag state.
Reproduction in a Real Multi-Agent Workflow
I use Codex as the parent orchestrator for a structured client-development workflow. Each role invocation is expected to run as an independent subagent so that implementation, architecture review, and code review do not share hidden context.
The reproduction was:
gpt-5.6-solas the parent.followup_taskto wake the previously completed agent instead of spawning a fresh isolated instance.This is not only a missing cleanup command or a stale UI indicator. The completed agent is actually addressable and reusable.
Observed Invocation Data
In one GPT-5.5 parent workflow on the same machine:
Its tool namespace included:
In a comparable GPT-5.6-sol parent workflow:
Repeated reuse included:
The workflow transcript explicitly described waking already completed agents through
followup_task.Practical Impact
Reusing completed agents causes context from earlier tasks to carry into later independent tasks.
This affects:
For example, an agent that previously implemented code may later be reused as a reviewer. Its retained implementation context can influence the supposedly independent review.
An external orchestrator also cannot safely record the agent as released. Writing a local release receipt does not prove that the native Codex agent was closed, especially when the same agent remains callable through
followup_task.Post-Update Verification
After updating to Desktop
26.915.31029and CLI0.155.0-alpha.9, I inspected the exact tool schema exposed to a freshgpt-5.6-solsession.The close operation is still absent.
I did not spawn another disposable probe after the update because the schema already showed that there would be no supported way to close it afterward. The actual reuse behavior was reproduced before the update, while the missing lifecycle capability has been reconfirmed after the update.
Expected Behavior
Codex should provide one of the following:
close_agentorrelease_agentoperation in the collaboration tool surface; orAfter finalization:
followup_task;If resumable completed agents are intentional, Codex still needs a separate permanent close/release operation for workflows that require strict context isolation.
Documentation Conflict
The current Codex documentation says:
It also says users can ask Codex to:
Documentation:
https://learn.chatgpt.com/codex/agent-configuration/subagents#orchestration-and-thread-controls
The current GPT-5.6-sol collaboration schema does not provide the documented close capability.
Could the Codex team please clarify:
I can provide sanitized session excerpts and tool-call records privately if needed. Full rollout files are omitted because they contain private repository context.
aphyllo commentedon Oct 1, 2026
Confirming the missing close/release capability in a current Windows Codex Desktop session (2026-10-01).
OpenAI.Codex_26.928.1915.0_x64)spawn_agent,followup_task,send_message,wait_agent,list_agents, andinterrupt_agentclose_agentor a documented equivalentThis is a schema-level observation in the current session; I did not spawn a disposable agent or measure concurrency-slot or resource retention.
interrupt_agentis not an equivalent because its schema says the child remains available for messages and follow-up tasks.The current subagent documentation still says users can ask Codex to close completed subagent threads. Please expose a supported close/release operation or clarify the intended lifecycle semantics and update the documentation. This appears to affect Desktop as well as the VS Code case in the original report.
aphyllo commentedon Oct 1, 2026
I am also encountering this with the Codex VS Code extension on Windows, and the missing close/release operation is blocking longer multi-agent workflows.
Environment checked locally: VS Code 1.140.0 (x64),
openai.chatgptextension 26.928.31416, Windows 10.0.26200,codex-cli 0.159.2, and[features] multi_agent = truewith[agents] max_threads = 10. My current Codex collaboration tool surface exposesspawn_agent,followup_task,send_message,wait_agent,list_agents, andinterrupt_agent, but noclose_agent. That tool-schema observation is from the current Codex session, not an independently captured VS Code extension trace.I have repeatedly hit the subagent limit after tasks completed while their threads remained open. That limit behavior is my user-observed symptom, not a measured slot-reclamation trace. Reusing those threads is not suitable for independent fresh-context reviews. Please prioritize a supported way to close/release completed subagents and verify that their slots are reclaimed, or document the intended replacement workflow.
benjaminstelzer commentedon Oct 9, 2026
Same here. My workflow relies on automatically spawning agents for coding and code reviews.
I increased the agent limit in
config.tomlas a workaround, but eventually Codex freezes completely, stops responding, and requires a restart.I don’t understand why
close_agentwasn’t implemented, especially since it was included in the original documentation. Unfortunately, if this feature never arrives, that would be a reason for me to look for an alternative. I’d be very disappointed, because I find Codex’s user experience almost ideal, particularly compared to Claude Code.