Skip to content

Codex Desktop leaves orphaned agent-browser headless Chrome processes consuming ~400% CPU #34178

Open

Description

@CorbinStewart

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

26.715.31925 (build 5551)

What subscription do you have?

Pro 20x

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?

A Codex Desktop task launched agent-browser 0.31.2 through pnpm dlx for browser-based visual assessment. After the task ended, the agent-browser controller and its headless Chrome process tree remained running for nearly three days.

The controller had been reparented to macOS PID 1, indicating that its original parent process had exited. No active client was connected to its session socket, but four Chrome subprocesses were each consuming approximately one full logical CPU core:

Process CPU
Chrome GPU process 99.5%
Chrome NetworkService 96.5%
Chrome StorageService 96.7%
Chrome renderer 99.4%

Combined CPU usage was approximately 392%.

Before discovering these processes, I had already force-quit Google Chrome, and Chrome was no longer running as a visible application on the Mac. I had also quit and relaunched Codex. The orphaned agent-browser controller and headless Chrome helpers survived both the Chrome force-quit and the Codex restart.

Chrome was launched invisibly with --headless=new and --enable-unsafe-swiftshader, using a temporary agent-browser profile rather than my normal Chrome profile. Google Chrome did not appear in the Force Quit Applications window when the orphaned helpers were discovered.

The originating Codex rollout contained ten commands that opened pages, changed viewport sizes, and captured screenshots. I found no corresponding close, stop, or kill command for the browser session.

This appears to be a task/subprocess lifecycle cleanup issue: an external browser-automation process survived after its controlling Codex process exited and continued consuming substantial CPU indefinitely.

What steps can reproduce the bug?

I have not intentionally reproduced this again because it can leave several CPU-intensive processes running for days, but the observed sequence was:

  1. Start a Codex Desktop task that performs browser-based visual assessment.

  2. Codex runs commands following this pattern:

    pnpm dlx agent-browser --session <SESSION> open <PUBLIC_URL>
    pnpm dlx agent-browser --session <SESSION> set viewport <WIDTH> <HEIGHT>
    pnpm dlx agent-browser --session <SESSION> screenshot <PATH> --full
    
  3. Allow the Codex task to complete or otherwise end without issuing:

    pnpm dlx agent-browser --session <SESSION> close
    
  4. The original controlling process exits, but agent-browser remains running and is reparented to PID 1.

  5. Force-quit the visible Google Chrome application. Chrome is no longer running as a visible app, but the separate headless agent-browser Chrome process tree remains.

  6. Quit and relaunch Codex Desktop. The orphaned controller and Chrome helpers remain running after the app restart.

  7. Open Activity Monitor and observe the GPU, renderer, network, and storage helpers each consuming approximately 93–101% CPU.

In this occurrence:

  • Codex conversation ID: 019f6979-5d48-7de0-8948-c4f31fe1b7ab
  • Originating turn ID: 019f6c08-88b2-72c0-8f0c-078eb93f577e
  • Browser session started: July 16, 2026 at approximately 1:52 PM EDT
  • Processes were discovered and sampled: July 19, 2026
  • agent-browser version: 0.31.2
  • Headless Chrome process version: 150.0.7871.116

The rollout contained ten commands for the session but no matching close, stop, or kill command.

What is the expected behavior?

Codex should reliably clean up browser-automation sessions and their complete process trees when:

  • A task completes successfully.
  • A task fails or is interrupted.
  • The controlling process exits.
  • The Codex app closes or restarts.

An external tool such as agent-browser should not remain orphaned under PID 1 with a headless Chrome process tree consuming multiple CPU cores.

If automatic cleanup cannot be completed, Codex should report the surviving process and provide a clear cleanup action.

Additional information

Environment:

  • macOS 26.5, build 25F71
  • Apple silicon, arm64
  • Hardware model: MacBookPro18,3
  • Codex Desktop: 26.715.31925, build 5551
  • Subscription: Pro 20x
  • agent-browser: 0.31.2
  • Chrome process version: 150.0.7871.116

Live diagnostics captured before termination:

  • Five 10-second macOS process stack samples
  • Process hierarchy and relevant launch arguments
  • PPID 1/orphaning evidence
  • Local controller and DevTools endpoints
  • Remaining browser targets
  • Sanitized originating Codex commands
  • Confirmation that no browser-session cleanup command was issued

A sanitized diagnostic archive is retained locally and can be provided privately to OpenAI maintainers upon request. It was sanitized to remove usernames, hostnames, repository names and paths, browser-session names, temporary-profile identifiers, emails, credentials, browser databases, and unrelated Codex content.

After collecting diagnostics, I sent SIGTERM to the orphaned agent-browser controller. All CPU-heavy Chrome children exited successfully. A remaining zero-CPU Chrome crash handler from the same session was then terminated separately. A final process check confirmed that the complete process tree was gone.

Possibly related:

Activity

  1. added
    app
    on Jul 19, 2026
  2. Snychng commented on Jul 28, 2026

    @Snychng

    I have encountered the same problem too.

  3. Snychng commented on Jul 28, 2026

    @Snychng

    Additional macOS reproduction: agent-browser close was invoked, but the Chrome process tree survived

    I encountered the same orphaned headless Chrome failure on a newer Codex Desktop and agent-browser version.

    Environment

    • Codex Desktop: 26.721.41059 (build 5848)
    • macOS: 26.5 (25F71)
    • Hardware: Apple M5, arm64, 10 logical CPU cores
    • agent-browser: 0.33.0
    • Google Chrome: 150.0.7871.129

    Observed behavior

    A Codex task used npx -y agent-browser with named sessions to test a local web application. The spawned Chrome instances used:

    • --headless=new
    • --enable-unsafe-swiftshader
    • isolated temporary agent-browser-chrome-<uuid> profiles

    Unlike the original report, the originating Codex rollout did contain cleanup commands:

    npx -y agent-browser --session <redacted> close >/dev/null 2>&1 || true
    npx -y agent-browser --session <redacted> close >/dev/null 2>&1 || true

    However, both the command output and exit status were suppressed. A process check performed immediately afterward still showed two headless Chrome instances and an agent-browser controller running.

    The surviving processes were eventually reparented to macOS PID 1 and remained alive for approximately 4 days and 17 hours.

    When discovered:

    • agent-browser session list returned No active sessions.
    • The controller socket and Chrome process tree were still present.
    • GPU, NetworkService, StorageService, and multiple renderer helpers were consuming approximately 78–101% CPU each.
    • Aggregate Chrome Helper usage fluctuated between roughly 400% and 685% CPU.
    • The browser processes used temporary automation profiles, not the user's normal Chrome profile.
    • Restarting or closing visible browser applications would not have affected these independent headless instances.

    Cleanup behavior

    Sending SIGTERM to the scoped browser/controller PIDs produced inconsistent results:

    1. One orphaned headless Chrome instance exited normally.
    2. The second instance only terminated some renderer processes.
    3. Its Chrome main process, GPU process, NetworkService, StorageService, and controller remained alive.
    4. Terminating the isolated process groups was required to remove the remaining processes.

    The cleanup was restricted to the affected temporary agent-browser profiles. An unrelated Chrome debugging instance and other Chromium-based applications remained untouched.

    Difference from the original report

    The original report describes a Codex rollout with no matching close command.

    In this reproduction, close was invoked, but:

    • cleanup errors were discarded with >/dev/null 2>&1 || true;
    • the post-cleanup process check already showed that the processes survived;
    • Codex did not treat the surviving process tree as a failed cleanup condition;
    • session bookkeeping later reported no active sessions even though the browser tree remained alive.

    This suggests two related lifecycle gaps:

    1. agent-browser close does not reliably terminate the complete Chrome process group.
    2. Codex does not enforce or verify the cleanup postcondition before completing a task.

    Expected behavior

    • agent-browser close should either terminate the entire scoped Chrome process group or return a visible non-zero error.
    • Codex should not suppress browser cleanup failures.
    • After closing a session, Codex should verify that no process using that session's temporary profile remains.
    • If graceful cleanup fails, Codex should terminate only the affected session's process group and report the fallback.
    • Session bookkeeping should not report No active sessions while the corresponding controller or Chrome process tree is still alive.

    Project paths, usernames, session names, temporary-profile UUIDs, and local URLs have been redacted.

  4. dcvilyz commented on Sep 25, 2026

    @dcvilyz

    Still an issue. just cleaned up 203 orphaned headless chromes, with 365 old atlas-browser-* taking up 68GB in profile folders.

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

    appbrowserbugperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions