Skip to content

[Windows App] Stale/orphaned subagents cause runaway session growth, thread errors, and archive failure #38805

Open

Description

@robertor-develop

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

26.810.41047

What subscription do you have?

ChatGPT Work

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

Long-running Codex App coordination sessions that use subagents can accumulate stale/orphaned agent state and very large JSONL transcripts. The App then becomes slow and unstable, the Subagents panel continues to show agents as active for days, repeated thread not found errors appear, and the affected task cannot be archived.

Observed in two successive coordination tasks:

  • Task A transcript grew to approximately 1.20 GB.
  • Task B transcript grew to approximately 472 MB.
  • Task B's Subagents panel showed 2 agents still active for roughly 3 days and 54 completed agents.
  • The UI repeatedly displayed thread not found for the affected task.
  • Archiving the task failed with an App error.

No customer data, repository contents, prompts, or transcript attachments are included in this report.

What steps can reproduce the bug?

  1. In the Windows Codex App, use a long-running main coordination task.
  2. Spawn and complete multiple bounded subagent runs over time.
  3. Mix subagent activity with coordination/wait activity across a long session.
  4. Continue using the same task after completed agents accumulate in the Subagents panel.
  5. Observe that some agents can remain shown as active after their useful work has ended.
  6. Continue until the transcript becomes very large.
  7. Reopen or interact with the affected task and attempt to archive it.

Observed results:

  • Stale agents remain listed as Processing for days.
  • Agent-related records and waits continue accumulating in session history.
  • The App emits repeated thread not found errors.
  • The task becomes difficult or impossible to use normally.
  • Archive fails.
  • Overall Codex App responsiveness degrades.

Affected session identifiers (provided for maintainers to correlate diagnostics):

  • 019f5bdf-53b3-7fb3-ad75-9bee0194b844 (~1.20 GB transcript)
  • 019fc779-001b-70e2-a2c0-645e8e4899d5 (~472 MB transcript)

What is the expected behavior?

Completed or terminated subagents should leave no live/orphaned runtime state. The App should enforce a hard circuit breaker before agent count or transcript size becomes dangerous, keep task ownership inspectable, allow reliable cancellation, and always allow an affected task to be archived. A stale agent must not generate persistent waits, callbacks, or repeated thread lookup failures.

Additional information

This appears related to #23700 (Stale Codex subagents), but the Windows App impact here also includes extreme transcript growth, repeated thread not found errors, system-wide App degradation, and archive failure.

Requested safeguards:

  • Explicit subagent ownership by the initiating task
  • No recursive subagent spawning unless explicitly enabled
  • Configurable hard agent ceiling
  • Per-run authorization and bounded lifetime
  • Reliable cancellation and cleanup
  • Session-size and agent-count circuit breakers
  • Clear stale/orphaned state diagnostics
  • Archive repair that does not require reopening or resuming corrupted runtime state

I can provide privacy-reviewed diagnostic counts or sanitized evidence if a maintainer identifies the exact safe diagnostic format needed. -----NEW INFO ---- The exact miss is now clear: MAIN 02 used visible thread-control tools wrapped inside custom_tool_call: exec, not just spawn_agent. The old script removed internal-agent calls but left 299 thread-routing calls plus their outputs, 126 duplicated session headers marked thread_source: subagent, 39 compaction payloads, 252 world-state snapshots, 975 turn contexts, and 1,077 old thread-setting records. Those are what rebuild the garbage and preserve the nightmare instructions.

Activity

  1. added
    bugSomething isn't working
    windows-osIssues related to Codex on Windows systems
    subagentIssues involving subagents or multi-agent features
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on Aug 15, 2026
  2. pomazanbohdan commented on Aug 23, 2026

    @pomazanbohdan

    Additional Windows cluster evidence: stale/orphaned children, persisted Active/Working state, large rollout growth, and archive failures appeared together after long multi-agent sessions. The cluster separates live execution from persisted projection/residency (#37042 and #39694) and requires backup-first cleanup with post-restart parity checks.

  3. LAVMendonca-labs commented on Aug 23, 2026

    @LAVMendonca-labs

    Fresh Windows reproduction on Codex Desktop 26.818.5229.0:

    • The Subagents panel shows 11 historical children as Processing, with displayed ages of roughly 1 day to 9 days.
    • Local lifecycle evidence shows that 10 of those 11 children had already emitted at least one FINAL_ANSWER. One has no visible terminal result.
    • The current collaboration readback does not expose those historical children; attempting to interrupt one by its former canonical path returns not_found.
    • Despite that, the UI continues to render all 11 as active/processing.
    • App-level list_threads did not return after more than 45 seconds and had to be aborted. An individual read_thread attempt against one stale child also did not return after more than 30 seconds.
    • The affected rollout is currently about 58.14 MiB.

    This looks like persisted UI/session projection diverging from authoritative runtime state, consistent with the issue description. No prompts, repository contents, private paths, credentials, or thread IDs are included here. A cropped Subagents-panel screenshot is available privately if maintainers need it.

  4. sideburns42 commented on Sep 16, 2026

    @sideburns42

    macOS variant: stale/orphaned subagents persist and exhaust agent capacity

    Related issue: #38805

    Environment

    • Codex desktop app on macOS
    • ChatGPT Work account
    • App version: [fill from About Codex]
    • macOS version: [fill in]
    • Date observed: 2026-09-16

    Summary

    A long-running Codex coordination task accumulated a very large number of subagent contexts. The task UI eventually displayed approximately 234 subagents.

    Many of these appeared to be completed or inactive, but the aggregate count persisted. Quitting and relaunching the ChatGPT/Codex application did not visibly clear the count. Other Work tasks did not show the same subagent population.

    The behavior appears to be a macOS variant of the stale/orphaned subagent problem described in issue #38805.

    Reproduction pattern

    1. Use one long-running coordination task.
    2. Spawn many bounded worker and reviewer subagents over time.
    3. Complete workers and attempt to close them after their handoffs.
    4. Continue using the same parent task for additional waves of work.
    5. Observe the Subagents count grow substantially.
    6. Quit and relaunch the desktop application.
    7. Reopen the task and observe that the accumulated subagent count remains.
    8. Attempt to continue spawning agents.

    Observed behavior

    • The task displayed approximately 234 subagents.
    • Completed or obsolete contexts appeared to remain associated with the task.
    • There was no visible global inventory or reliable bulk-cleanup control.
    • The orchestration layer eventually returned an agent thread limit reached error when additional workers were requested.
    • The controller could close known agent IDs individually, but could not enumerate or clean up unknown historical/orphaned contexts.
    • Archiving the parent task was unclear as a cleanup mechanism and did not provide confidence that subagent capacity would be released.
    • Restarting the application did not appear to reconcile the persisted subagent count.

    Expected behavior

    • Completed, interrupted, or explicitly closed subagents should be removed from active capacity accounting.
    • Restarting the application should reconcile persisted agent state with actual runtime state.
    • The parent task should expose a reliable inventory of child agents and a safe “close all completed/orphaned agents” operation.
    • Historical child records should not continue consuming the session’s agent limit.
    • Archiving a parent task should either clean up its child-agent runtime state or clearly document that separate cleanup is required.
    • A circuit breaker should prevent a task from accumulating hundreds of stale child contexts.

    Diagnostic information

    In this case:

    • The parent task was a long-running product-owner/orchestration task.
    • Workers and reviewers were created for independent repository research, evidence review, and implementation handoffs.
    • Durable work products were retained externally in GitHub Draft pull requests.
    • Known temporary agents were closed after handoff where the controller could address them.
    • At least one obsolete completed worker was still discoverable later and had to be closed manually.
    • The UI count was substantially larger than the set of currently active workers.
    • No customer data, repository contents, private prompts, or full transcripts are included here.

    Potentially useful diagnostics for maintainers:

    • Parent task/session identifier: [fill from task details if available]
    • Current app version and macOS version
    • Screenshot showing the 234-subagent count
    • Sanitized subagent-state metadata showing terminal versus active status
    • Whether the count decreases after closing a known completed agent
    • Whether the count changes after archiving/unarchiving the parent task
    • Any app logs containing thread not found, stale callback, orphan cleanup, or agent-limit errors

    Hypothesis

    The parent task may be retaining persisted child-agent records after their runtime state has terminated. Capacity accounting may be based on historical child records rather than live agent state, and application restart may not reconcile those records.

    This is a hypothesis only; the important symptom is that completed/orphaned subagent state appears to remain attached to the task and can exhaust the agent limit.

    Impact

    This makes long-running coordination tasks progressively less usable:

    • New parallel work cannot be started.
    • The task becomes difficult to recover or archive.
    • Users cannot determine which contexts are actually live.
    • Manual cleanup requires already knowing individual agent identifiers.
    • Restarting the application does not provide a reliable recovery path.

    Powered by Codex & OWL
    Version 26.908.70816

    Released Sep 14, 2026

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

    appIssues related to the Codex desktop appbugSomething isn't workingperformancesessionIssues involving session (thread) management, resuming, forking, naming, archivingsubagentIssues involving subagents or multi-agent featureswindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions