Skip to content

[codex] Improve browser bridge connection errors#1229

Open
961882 wants to merge 1 commit intojackwener:mainfrom
961882:codex/browser-connect-error-recovery
Open

[codex] Improve browser bridge connection errors#1229
961882 wants to merge 1 commit intojackwener:mainfrom
961882:codex/browser-connect-error-recovery

Conversation

@961882
Copy link
Copy Markdown
Contributor

@961882 961882 commented Apr 30, 2026

Summary

Improve BROWSER_CONNECT failures for Browser Bridge extension disconnects.

This change makes browser connection failures easier for both humans and automation to diagnose by surfacing the existing connection kind in structured error output and by recommending the lower-risk recovery path first.

What changed

  • Add machine-readable kind, layer, and recovery fields to BrowserConnectError envelopes.
  • Classify extension disconnects as the browser_bridge layer.
  • Prefer extension reload guidance before daemon restart guidance when the daemon is running but the extension is disconnected.
  • Update doctor messaging for extension-disconnected states.
  • Add unit coverage for the structured error fields and updated recovery hint.

Root cause

BrowserConnectError already tracked a coarse failure kind internally, but the CLI error envelope only exposed the generic BROWSER_CONNECT code. As a result, agents and scripts had to infer whether the failure was in daemon startup, extension connection, or command execution.

The human hint also jumped too quickly to daemon restart guidance, even when the lower-risk fix is reloading the already-installed OpenCLI extension in chrome://extensions.

User impact

Normal successful commands remain unchanged.

On failure, users and agents get clearer, more actionable information:

  • kind: extension-not-connected
  • layer: browser_bridge
  • safe recovery steps such as reloading the OpenCLI extension and retrying once
  • manual recovery steps such as running opencli doctor

Validation

  • npm test -- src/errors.test.ts src/browser.test.ts src/doctor.test.ts
  • npm run typecheck

@961882 961882 marked this pull request as ready for review April 30, 2026 16:31
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