Skip to content

feat(browser): attach to a running Chrome session via direct CDP#119

Open
dedene wants to merge 1 commit intosteipete:mainfrom
dedene:browser-attach-running-direct-cdp
Open

feat(browser): attach to a running Chrome session via direct CDP#119
dedene wants to merge 1 commit intosteipete:mainfrom
dedene:browser-attach-running-direct-cdp

Conversation

@dedene
Copy link
Copy Markdown

@dedene dedene commented Mar 19, 2026

Summary

Chrome’s new chrome://inspect/#remote-debugging flow is now available in stable Chrome 144. The Chrome team’s write-up is here:
https://developer.chrome.com/blog/chrome-devtools-mcp-debug-your-browser-session#how_it_works

The important change for Oracle is that Chromium browsers can now grant a remote debugging session to an already-running browser after explicit user approval. That solves the stale-session-cookie problem in browser mode: instead of launching a separate automation profile and hoping ChatGPT login state is still valid, Oracle can attach to the browser session you are already using.

In practice, that means you can keep using your normal browser window, stay signed in to ChatGPT, keep other tabs open, and let Oracle do its work in a dedicated tab in that same session. This should also work for similar Chromium browsers that expose the same remote-debugging flow, not just stock Chrome.

This implementation was inspired by the recent direct-CDP attach work in chrome-devtools-mcp, but adapted to Oracle’s existing browser automation flow.

What

This PR adds a local attach-running path that:

  • introduces --browser-attach-running for local browser attach
  • uses local DevToolsActivePort metadata to find the selected browser websocket
  • connects directly over CDP instead of going through chrome-devtools-mcp
  • opens a dedicated Oracle-owned tab and reuses the existing browser automation flow
  • keeps reattach/session plumbing aware of the attached browser target

Why

  • avoids stale or missing cookies in temporary automation profiles
  • works with the new remote-debugging permission flow
  • lets Oracle share the user’s real browser session while staying isolated to its own tab
  • should extend to Chromium-based browsers exposing the same flow, not just Chrome
  • makes browser mode much more practical for long-lived ChatGPT sessions and SSO-gated workflows

Verification

  • pnpm vitest run tests/browser/attachRunning.test.ts tests/browser/chromeLifecycle.test.ts
  • pnpm build
  • pnpm vitest run --exclude 'tmp/**' tests/browser tests/cli/browserConfig.test.ts tests/cli/browserDefaults.test.ts tests/cli/sessionRunner.test.ts

ps. To fully live-test this reliably against current chatgpt.com, we also need the model-selection fix from #118, or something equivalent. Recent ChatGPT UI changes made Oracle stop selecting models reliably, so attach-running can look broken unless that path is fixed too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant