Skip to content

[macOS 26.1007.30912] Idle thread runtimes retain substantial memory under pressure; need safe non-archiving release #53310

Open

Description

@bigbugneil

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

Codex Desktop 26.1007.30912, build 20156 (read from the installed app's Info.plist).
Bundled CLI/app-server: codex-cli 0.162.0-alpha.17.2.

What subscription do you have?

Not included in this public diagnostic report.

What platform is your computer?

macOS 15.5, Apple silicon, 16 GiB RAM.
uname -mprs: Darwin 24.5.0 arm64 arm.

What issue are you seeing?

Completed, idle chats retain separate local tool runtimes for a long time while the Mac is already under yellow memory pressure. Opening historical chats also initializes additional helper batches. Users cannot easily distinguish active work from retained idle runtimes or release one idle chat's resources while keeping its history and normal sidebar position.

This report is deliberately about expensive idle retention and safe reclamation, not a proven unbounded memory leak. Automatic cleanup DID occur during observation.

Measurements on 2026-10-12

Initial system snapshot:

  • Activity Monitor: about 13.7 GB used out of 16 GB, yellow memory pressure.
  • Compressed memory: about 6.4–7.5 GiB across samples.
  • Swap initially about 665–673 MiB; later about 4.0 GiB during a period that included browsing historical chats. Other apps were also running, so this is not attributed exclusively to Codex.
  • Codex-owned executable processes: roughly 6.5–7.0 GiB summed physical-footprint accounting initially.

A representative breakdown:

  • 13 renderer processes: approximately 3.3 GiB.
  • 9 code-review service instances: approximately 781 MiB.
  • 9 desktop app-tools service instances: approximately 379 MiB.
  • Other computer-use/REPL helpers: approximately 1 GiB.
  • Most tool helpers showed negligible CPU-time changes in a 35-second sample.

By correlating process creation times, parent/child relationships, thread start/resume logs, and live thread status, two completed idle chats could be associated with:

  • Chat A: 8 tool/runtime processes, approximately 423 MiB.
  • Chat B: 5 tool/runtime processes, approximately 164 MiB.

Both chats' most recent turns were completed. A separate active task and the diagnostic chat were deliberately preserved; no processes were killed and the app was not restarted.

Cleanup evidence and limits

  • After the user closed two embedded pages, renderer count fell from 13 to 11 and old renderer PIDs disappeared. Thus not all renderers were leaked, and renderer count is not equivalent to visible tab count.
  • Logs later recorded successful thread/unsubscribe operations for some idle chats; their helper groups exited.
  • Chat B subsequently became notLoaded and all 5 associated helpers were absent. Chat A still retained approximately 422 MiB in 8 helpers at the last check.
  • The helper exits establish lifecycle cleanup, not an equivalent measured drop in system-wide physical RAM.
  • During historical-chat browsing, new helper batches aligned with thread/resume events. Codex process footprint rose substantially during that interval, but ongoing activity prevents treating this as an isolated A/B measurement.

Read-only inspection of this installed build's frontend bundle found an inactive-thread unsubscriber with a 10,800,000 ms (3-hour) idle TTL and a cap of 10 eligible inactive owner threads. Active views, stream followers and running work are excluded. This is an implementation clue, not proof that every retained process is abandoned or that all memory-pressure handling is absent.

What steps can reproduce the bug?

Observed workflow, rather than a clean-room minimal reproduction:

  1. Use several local chats with bundled desktop tools/code-review and computer-use/REPL facilities.
  2. Finish work in some chats while leaving another task running.
  3. Switch away from completed chats; inspect their helper process groups and live thread status.
  4. Open several historical chats without starting new user tasks.
  5. Observe new helper batches correlated with thread resume, and idle groups remaining resident.
  6. Close embedded pages separately and compare renderer exit behavior with tool-runtime retention.
  7. Observe eventual automatic unsubscribe and helper exit without terminating active work.

What is the expected behavior?

  • Bound retained idle runtime memory, especially on a 16 GiB machine under memory pressure.
  • Start tool servers lazily or safely reuse them where appropriate.
  • Reclaim eligible idle runtimes more promptly under pressure.
  • Provide a supported “Release idle runtime” action that preserves chat history AND normal sidebar placement, and refuses to unload running tasks or live dependencies.
  • Show chat-to-process/resource ownership so users can understand what will be released.
  • Avoid requiring whole-app restart, forced process termination, or chat archival merely to reclaim idle resources.

Additional information

Related: #44996 and #51649. This newer macOS report adds observed successful cleanup, measured per-idle-chat groups, and a specific retention-policy/release-control concern; it does not claim the same unbounded failure mechanism as those reports.

Memory methodology: macOS proc_pid_rusage with RUSAGE_INFO_V2 / ri_phys_footprint, plus ps, vm_stat, sysctl, Activity Monitor and sanitized app lifecycle metadata. Summed footprints are process accounting (including compressed-memory charges), not a promise of uniquely reclaimable resident RAM.

Private chat titles/IDs, project paths, credentials, full transcripts and raw logs have been omitted. No heap dump, forced-GC test, controlled restart comparison or exhaustive UI audit was performed. The available automation tools exposed archival but no standalone runtime-release operation; that alone does not prove no such action exists anywhere in the UI.

Activity

  1. added
    bug
    app
    session
    on Oct 12, 2026
  2. scefali commented on Oct 21, 2026

    @scefali

    [Codex Assisted] Related evidence from my report #53562, now on ChatGPT/Codex 26.1013.40934 (build 20770), macOS with 64 GiB RAM: an October 21 snapshot showed 46 Codex (Renderer) processes totaling about 11 GiB RSS, with the largest at about 2.73 GiB. The bundled Codex CLI was separately about 3.49 GiB RSS. This does not identify which processes belong to idle chats, and summed RSS can count shared pages more than once. My earlier report verified one visible window during similar renderer accumulation. I support a safe, non-archiving way to release eligible inactive chats' runtimes, plus a supported chat-to-process/resource view. I cannot establish that this has the same root cause as the helper retention documented here.

  3. erikhhansen commented on Oct 22, 2026

    @erikhhansen

    macOS: expensive completed-helper retention under memory pressure

    Additional macOS measurements from 21–22 October 2026, submitted with the user's authorization. Related to #51649. Times below are CAT (UTC+02:00).

    Environment

    • Apple M2 Pro MacBook Pro, 16 GiB RAM, macOS 27.0.1.
    • Desktop 26.1013.40934, build 20770, production distribution.
    • Bundled backend 0.163.0-alpha.10.2, verified from its executable and package metadata.
    • Normal multi-chat development with local tool integrations.
    • The configured updater offers 26.1016.61520, build 21421; it has not been installed because active work must not be interrupted.

    Observed behaviour

    Completed delegated helpers retain separate tool environments while the application remains running. The original app and backend process identities stayed unchanged throughout the measurements.

    On 21 October, disabling composer predictions through the app's setting and allowing four tracked temporary cohorts to retire naturally coincided with a Codex-family footprint change from 12.497 GiB / 218 processes to approximately 9.675 GiB / 156 processes and pressure returning from warning to normal. Other work continued, so the entire net change is not an isolated causal estimate.

    On 22 October, four completed delegated helpers still had identifiable tool-process cohorts. Their last recorded turns had completed earlier, but server logs showed them resumed without active turns at approximately 08:18 CAT. We cannot identify which client owned that connection or the exact retention condition.

    With explicit user approval, each child was archived separately after verifying idle/completed status and no registered shell work or recorded descendants:

    • Each archive was followed within approximately 2–6 seconds by the disappearance of that child's 16 tracked process identities.
    • All four experiments together retired 64 tracked processes, accounting for 2.142 GiB at their respective before samples.
    • Unselected cohorts stayed intact at each step. The parent remained unarchived.
    • Shutdown logs recorded an existing listener and no active turn.
    • The saved parent/child histories remained byte-identical.
    • There were no direct process signals and no app restart.

    The final measured state at 09:24 CAT had normal memory pressure and no new swap-outs during the approximately two-minute final batch observation. Pressure was already normal before the last three archives, so that improvement is not attributed to those three actions.

    Interpretation and limits

    These measurements establish resource retention tied to loaded sessions, not a proven unbounded leak. Native macOS proc_pid_rusage / phys_footprint was used, with process start identities to guard against PID reuse. Footprints include compressed/swapped accounting and are not unique resident RAM. Other concurrent process activity was excluded from the claim about the 64 tracked processes.

    We understand the documented 30-minute no-subscriber/no-activity grace period and found an additional three-hour eligible inactive-owner timer in the installed desktop. The archival checks occurred roughly an hour after the recorded resumes; we are not claiming that a three-hour timer was exceeded or that every subscriber was gone.

    The public source tag matching the installed backend includes PR #52081 (ancestry comparison). These observations therefore concern a version whose matching source lineage already includes that fix; this is version/ancestry evidence, not a reproducible binary attestation.

    Requested maintainer clarification

    1. Is retention of full tool environments for completed delegated helpers intended while the Mac is under memory pressure, and what is the expected automatic-release boundary?
    2. Is this covered by an existing retention/performance bug? Which desktop version fixes it, if any?
    3. Is there a supported product mechanism for safe automatic reclamation that does not require routine archival, disabling useful features, or restarting active work?

    Aggregate evidence and sanitized lifecycle extracts are available. No private chat titles, conversation identifiers, project paths, credentials, raw transcripts, or full command lines are included here.

  4. Ghost-Sam1222 commented on Nov 14, 2026

    @Ghost-Sam1222

    Adding a second data point for the same scenario, on a different configuration: macOS 15.7.7 (24G720), Apple Silicon
    M1, 16 GiB, app 26.1106.51428 (build 26605), bundled codex-cli 0.167.0-alpha.4.1.

    Confirmed: completed threads keep a resident runtime group after switching away.

    • Fresh launch, then threads opened at 08:48, 08:49, 08:52 and 09:47 (four completed, one active). Each new thread
      created a group of 5 processes (2 node, 3 node_repl).
    • At 09:52 — more than an hour after I had moved on from the 08:48 thread — its group was still resident.
      Total: 25 sidecar processes, ~150 MB summed RSS.
    • All of them were released only by Cmd-Q. Simply relaunching the app does not recreate them, so the retention is
      per-thread and bounded by app lifetime, not by idle time.

    Addition: MCP servers are duplicated per open thread, not shared.

    • Two threads open at the same time produced two identical rea mcp processes at 229 MB phys_footprint each
      (458 MB duplicated), plus two copies of an auxiliary node ./server.mjs at 44-45 MB.
    • codex features list reports mcp_connection_sharing as under development / false in this build, which would be
      consistent with per-thread instantiation.
    • Implication: any bound on idle thread runtimes will not bound MCP duplication; a 16 GiB machine pays it once per
      open thread, including threads whose work is long finished.

    Baseline and growth on the same machine:

    • Cold start: ~7-8 renderers + 5 utility services (GPU / network / storage / audio / node) = ~1.8 GB summed
      phys_footprint with nothing running.
    • After 16.5 hours: 48 processes, ~4.4 GB summed phys_footprint. Heaviest renderer grew 383 MB -> 823 MB
      (peak 1562 MB; app-specific tag 16 214 -> 531 MB, tag 14 160 -> 279 MB), i.e. growth happened inside a
      long-lived renderer with no reclamation observed.
    • Cmd-Q + relaunch: back to 18 processes / 1.77 GB.

    Method: sysctl KERN_PROC_ALL/KERN_PROCARGS2 + proc_pidinfo for pid/ppid/start-time/thread count, macOS footprint
    for phys_footprint, vm_stat and sysctl vm.swapusage. No heap dumps. Summed footprints are process accounting and
    may double count shared pages; I am not claiming an unbounded leak, only expensive idle retention plus per-thread MCP
    duplication.

    (in-app feedback was submitted through the desktop app's feedback dialog; no Feedback ID was surfaced by this build.)

    Evidence bundle (sanitized export from the app's own diagnostics): https://gist.github.com/Ghost-Sam1222/d7b983f7b9fbb72c1769ca39ad3e9670
    It contains process-memory-diagnostics.json (24 Codex processes / 2.74 GiB summed RSS with 7 renderers at capture
    time), app-server-diagnostics.json (mcp.connections.live = 5) and a path-redacted codex doctor report.

    The "release idle runtime without archiving" control requested in the report would already help a 16 GiB machine
    substantially. I can supply additional snapshots on request.

  5. suryar113 commented on Nov 15, 2026

    @suryar113

    Does the memory come back on its own if you leave the app idle for a few hours, or only when you quit it?

  6. erikhhansen commented on Nov 15, 2026

    @erikhhansen
  7. suryar113 commented on Nov 18, 2026

    @suryar113

    Good catch on suggested prompts, thank you. Did turning that off stop the finished chats from keeping their helper processes at all, or just shrink how much memory each one holds?

  8. erikhhansen commented on Nov 18, 2026

    @erikhhansen

    Hi Surya,

    I should qualify my earlier reply. Disabling suggested prompts appeared to improve the overall memory situation, but I didn’t run a controlled comparison, so I can’t say whether it reduced memory per helper or changed how many helpers were retained.

    In the October 21–22 measurements I posted, four completed helpers still had resident process groups the following day. Archiving them individually released their associated processes without restarting the app.

    So I haven’t established that disabling suggested prompts fixes the retention itself. My earlier “seemed to resolve” comment referred to the overall improvement, rather than a verified fix.

    Regards,
    Erik

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

    appbugperformancesession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions