Skip to content

--browser-attach-running fails on Chrome 151: discovery needs a DevToolsActivePort file Chrome no longer writes #414

Description

@devYRPauli

Summary

--browser-attach-running cannot find a browser on Chrome 151, even when the DevTools endpoint is live and answering. Attach discovery looks for a DevToolsActivePort file in the user data directory, and Chrome 151 does not write one.

Every attach run fails with:

ERROR: No running browser with attach metadata matched 127.0.0.1:9222. Enable remote debugging in chrome://inspect/#remote-debugging first.

The message points at remote debugging, which is already enabled, so it sends you looking in the wrong place.

Environment

  • oracle 0.18.0
  • Chrome 151.0.7922.174
  • macOS, Apple silicon

Reproduction

Start Chrome with remote debugging and a user data directory under the macOS discovery root:

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9222 \
  --user-data-dir="$HOME/Library/Application Support/AttachProfile" \
  --no-first-run --no-default-browser-check https://chatgpt.com/

Confirm the endpoint is up:

curl -s http://127.0.0.1:9222/json/version
# {"Browser":"Chrome/151.0.7922.174","Protocol-Version":"1.3", ... }

Chrome's own stderr also reports it:

DevTools listening on ws://127.0.0.1:9222/devtools/browser/609117bf-...

Then run any attach command:

oracle --engine browser --browser-attach-running -p "Reply with OK." -f some.jpg
# ERROR: No running browser with attach metadata matched 127.0.0.1:9222.

The user data directory contains no DevToolsActivePort file:

find "$HOME/Library/Application Support/AttachProfile" -maxdepth 3 -name DevToolsActivePort
# (no output)

Cause

resolveAttachRunningConnection (src/browser/attachRunning.ts) calls discoverDevToolsActivePortCandidates (src/browser/detect.ts:223), which walks the roots from resolveDevToolsActivePortDiscoveryRoots (src/browser/detect.ts:143, ~/Library/Application Support on macOS) looking for DevToolsActivePort files.

Discovery is therefore file-based. It never contacts the endpoint the user asked for. When Chrome does not write that file, candidates is empty and attachRunning.ts:36 throws, regardless of whether 127.0.0.1:9222 is serving.

Workaround

Writing the file by hand makes attach work immediately:

WS=$(curl -s http://127.0.0.1:9222/json/version | jq -r .webSocketDebuggerUrl)
printf '9222\n%s\n' "${WS#ws://*[0-9]}" > "$HOME/Library/Application Support/AttachProfile/DevToolsActivePort"

After that the same command connects and completes normally, including attachment upload and submission.

Suggested direction

Two options, both small:

  1. When an explicit host and port are known, probe http://host:port/json/version first and use webSocketDebuggerUrl from the response. Fall back to file discovery only when that fails. This removes the dependency on a Chrome implementation detail for the case where the user already told you where the browser is.
  2. Keep file discovery, but on failure say what was actually looked for, for example "no DevToolsActivePort file found under <root>; the endpoint at 127.0.0.1:9222 was not probed". The current message sends people to chrome://inspect, which does not help.

Option 1 also fixes the case where the profile lives outside the platform discovery root, which is easy to hit with a throwaway profile in /tmp.

I am happy to send a PR for either if you have a preference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions