Skip to content

[Feature] Auto-launch Chrome when Browser Bridge extension is not connected #1075

@hlj206

Description

@hlj206

Feature Request: Auto-launch Chrome when Browser Bridge extension is not connected

Problem

When the Chrome extension (Browser Bridge) is not connected, opencli immediately throws a BROWSER_CONNECT error with no recovery attempt:

ok: false
error:
  code: BROWSER_CONNECT
  message: Browser Bridge extension not connected

This creates a poor UX — users must manually start Chrome, verify the extension is loaded, then retry the command.

Proposed Solution

Before throwing BROWSER_CONNECT, opencli should proactively attempt to start Chrome and wait briefly for the extension to connect, similar to the self-healing logic already present in some CLI wrappers.

Pseudo-code (~5 lines):

if (error.code === "BROWSER_CONNECT") {
  console.warn("Chrome not connected, attempting to start...");
  spawn("google-chrome", [...args]); // or appropriate platform command
  await sleep(2000); // wait for extension to init
  // retry once, then fail with original error if still failing
}

Why this helps

  • New users: Get a running experience instead of a cryptic error
  • WSL/Linux users: Chrome often needs manual export DISPLAY=:0 + launch
  • Recoverable: Only adds ~2s delay on failure; transparent to already-connected users

References

  • Similar pattern in opencli doctor and Chrome auto-restart crontab setups
  • BROWSER_CONNECT is the top user friction point in WSL environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions