[macOS] Chrome Browser Use leaves localhost agent tabs after transport/turn cleanup is interrupted

Resolved 💬 3 comments Opened Aug 19, 2026 by CH4ACKO3 Closed Aug 20, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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

26.814.41407 (bundle 6720). The installed ChatGPT for Chrome extension is 1.2.27267.15375.

What subscription do you have?

Pro

What platform is your computer?

Darwin 25.4.0 arm64 arm (macOS 26.4, build 25E246)

What issue are you seeing?

Codex Browser Use / Computer Use intermittently leaves externally visible Chrome tabs pointing to expired local development servers, for example:

  • http://127.0.0.1:65118/
  • http://127.0.0.1:65146/
  • http://127.0.0.1:65176/

Several tabs can appear together when multiple Codex sessions or agents perform browser checks. Once the ephemeral preview server exits, the retained tabs become blank Chrome network-error pages. They are not opened by the local application's Git hooks or by user navigation.

A direct reproduction showed a new random localhost Chrome tab appearing when Computer Use initialized. Chrome History records the affected development pages with:

  • no referring visit (from_visit = 0)
  • an AUTO_TOPLEVEL transition
  • the title served by the temporary local preview while it was alive

This is consistent with an extension/API-created top-level tab rather than a clicked link.

What steps can reproduce the bug?

  1. Start a local development preview on 127.0.0.1 using an ephemeral port.
  2. Ask a Codex task to inspect or interact with it through Chrome Browser Use / Computer Use.
  3. Interrupt, replace, or otherwise end the task while its Node REPL/native browser transport is restarting or disconnecting, before normal turn finalization completes. Concurrent Codex tasks make the problem easier to observe.
  4. Stop the ephemeral preview server.
  5. Observe that one or more Chrome tabs created by the agent remain open at the now-dead random localhost URLs.
  6. Repeat browser work across tasks; the orphan tabs accumulate.

The normal successful-turn path generally cleans up the tab, so the important reproduction condition is losing the normal turn-end/finalize path.

What is the expected behavior?

Agent-created Chrome tabs should be ephemeral and should be closed when the turn ends, is cancelled, or loses its native transport. Cleanup should remain reliable even when the explicit turn-ended message is never delivered.

User-owned tabs and tabs explicitly marked deliverable or handoff must remain open.

Additional information

I inspected the currently installed packaged extension/runtime to narrow down the lifecycle gap:

  1. A newly created controlled tab is leased with origin agent.
  2. The normal turn-end path enumerates active leases, separates handoff, deliverable, agent-created, and user tabs, then removes the agent-created tabs and releases their leases.
  3. The native heartbeat/transport failure path only stops active overlay/control sessions and detaches debuggers. It does not run the browser-session turn cleanup, remove agent-created tabs, or release their tab leases.
  4. Therefore, if the Node REPL/native transport disappears before delivering the explicit turn-ended notification, the only path that calls chrome.tabs.remove() is skipped and the visible tab survives.

A robust fix would reconcile browser sessions on native transport loss/heartbeat failure:

  • end or abort every active browser turn at the browser-session layer;
  • close unmarked tabs whose lease origin is agent;
  • preserve user-origin tabs and explicit deliverable/handoff tabs;
  • detach debuggers and clear overlays/favicons;
  • release persisted tab leases even if tab removal reports that a tab is already gone.

Suggested regression test:

  1. Create and navigate an agent-origin tab.
  2. Terminate/disconnect the client before finalize/turn-ended is delivered.
  3. Trigger heartbeat/transport cleanup.
  4. Assert the agent tab is removed and its lease is released.
  5. Repeat with user, deliverable, and handoff tabs and assert they are preserved according to policy.

Possibly related but broader: #39062 reports accumulated Chrome tabs and helper processes on Windows. This report is a narrower macOS reproduction with a specific abnormal-termination cleanup gap.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 8 days ago

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

  • #39062
  • #39031

Powered by Codex Action

CH4ACKO3 · 8 days ago

I reviewed both suggested duplicates and believe this issue should remain open because it captures a narrower, independently actionable failure mode:

  • #39031 concerns an interrupted in-app Browser/headless Chrome process tree. This report concerns visible, agent-created tabs left in the user's external Chrome window after the local preview has exited.
  • #39062 is a broad Windows resource/process/tab accumulation report without an isolated cleanup path. This report has a reproducible macOS case and identifies the specific lifecycle gap between normal turn finalization and native transport/heartbeat failure.
  • In the normal turn-end path, agent-origin tab leases are classified, the corresponding tabs are removed, and leases are released. On native transport/heartbeat loss, the observed path stops active control sessions and detaches debuggers but does not perform the browser-session cleanup that removes agent tabs and releases their leases.

The symptom may share a broader lifecycle theme with both issues, so they remain useful related references, but neither currently captures this external-Chrome tab-leasing cleanup gap or the proposed regression test.

CH4ACKO3 · 7 days ago

Closing this report after identifying the actual cause. The tabs were not created by Codex Browser Use or by a transport-cleanup failure. The currently installed DSH rc.8 opens the default browser for local dsh web launches unless --no-open is passed. Our Studio Preview launcher and several Harmony/Studio E2E launch paths omitted that flag, so each temporary Host opened its ephemeral localhost URL in Chrome; after the Host exited, the tab became a blank network-error page. We added --no-open to those programmatic/test launch paths and verified the real integration flow completes without creating any high-port Chrome tabs. The lifecycle analysis in the original report was therefore based on an incorrect attribution. Sorry for the noise.