[macOS] Chrome Browser Use leaves localhost agent tabs after transport/turn cleanup is interrupted
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_TOPLEVELtransition - 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?
- Start a local development preview on
127.0.0.1using an ephemeral port. - Ask a Codex task to inspect or interact with it through Chrome Browser Use / Computer Use.
- 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.
- Stop the ephemeral preview server.
- Observe that one or more Chrome tabs created by the agent remain open at the now-dead random localhost URLs.
- 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:
- A newly created controlled tab is leased with origin
agent. - 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. - 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.
- 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/handofftabs; - detach debuggers and clear overlays/favicons;
- release persisted tab leases even if tab removal reports that a tab is already gone.
Suggested regression test:
- Create and navigate an agent-origin tab.
- Terminate/disconnect the client before finalize/turn-ended is delivered.
- Trigger heartbeat/transport cleanup.
- Assert the agent tab is removed and its lease is released.
- 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.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I reviewed both suggested duplicates and believe this issue should remain open because it captures a narrower, independently actionable failure mode:
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.
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 weblaunches unless--no-openis 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-opento 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.