Skip to content

feat(browser): auto-detect chromium browsers for bridge#743

Open
umnooob wants to merge 6 commits intojackwener:mainfrom
umnooob:codex/chromium-browser-auto-detect
Open

feat(browser): auto-detect chromium browsers for bridge#743
umnooob wants to merge 6 commits intojackwener:mainfrom
umnooob:codex/chromium-browser-auto-detect

Conversation

@umnooob
Copy link
Copy Markdown

@umnooob umnooob commented Apr 3, 2026

Related issue: #742

Summary

This PR improves Browser Bridge connection behavior in two steps:

  1. Auto-detect supported Chromium-based browsers
  2. Prefer already-running browsers before launching new ones

Supported browser family order remains fixed:

  • Chrome
  • Edge
  • Chromium

Connection attempts now work like this:

  • detect installed browsers
  • split them into running and non-running candidates
  • try running candidates first, preserving the same brand order
  • then try non-running candidates, preserving the same brand order

It also lets opencli doctor show the browser inferred from this run when connectivity is established during
the current attempt.

Included commits

  • 9f9705c feat(browser): auto-detect chromium browsers for bridge
  • f2af57b feat(browser): prefer running browsers for bridge

What changed

Browser auto-detect

  • detect installed stable Chromium-based browsers on macOS / Linux / Windows
  • support:
    • Chrome
    • Edge
    • Chromium

Running-browser preference

  • detect which supported browsers are already running
  • reorder connection attempts so running browsers are tried first
  • preserve the existing brand order inside each group

Doctor inference

  • when the extension connects during the current run, doctor reports the inferred browser for that run
  • no extension protocol changes
  • if the extension was already connected before the run started, doctor does not pretend to know the browser

Messaging

  • keep Chromium-based wording in install/help text
  • keep detected/tried browser info in failure output

Files changed

  • src/browser/candidates.ts
  • src/browser/candidates.test.ts
  • src/browser/bridge.ts
  • src/browser.test.ts
  • src/doctor.ts
  • src/doctor.test.ts
  • src/execution.ts
  • src/doctor.ts
  • scripts/postinstall.js

Notes

  • no new config
  • no CDP fallback
  • no extension handshake/browser identity protocol changes
  • doctor browser display is inference from the current run only

Type of Change

  • ✨ New feature

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Screenshots / Output

image

umnooob and others added 6 commits April 4, 2026 00:51
- Reuse discoverAppPath/detectProcess from launcher.ts instead of duplicating
- Add spawn error handler to prevent unhandled ENOENT crashes
- Simplify _tryLaunchBrowsers: remove _tryCandidateGroup indirection
- Extract BROWSER_DEFS constant for clarity
…s conflict

- Restore per-browser time budget to fairly distribute timeout across candidates
- Replace _lastDetectedBrowsers/_lastTriedBrowsers with LaunchResult return value
- Remove 'chrome.exe' from Chromium processNames to avoid Windows conflict with Chrome
- Remove redundant env spread in spawn options
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.

2 participants