fix: make the browser bridge actually connect (offscreen path + popup status) + e2e verified - #1
Merged
Merged
Conversation
The WS host was silent, so pairing/handshake failures were undebuggable. Emit stderr lines (never stdout — that carries MCP) for listen, connect, origin/token rejects, auth, client-replace, and close-with-code. These directly surfaced the offscreen connect bug fixed in this branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
createDocument() used "offscreen.html", but crxjs emits the file at
dist/src/offscreen.html (same src/ prefix as popup + worker). The bad
path 404'd, so the offscreen document never loaded, its onMessage
listener never registered, and offscreen:connect had no receiver
("Could not establish connection. Receiving end does not exist"). The
WebSocket was never even dialed — the extension could never connect.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The popup set "Connecting…" on submit and never updated, so it hung on that label even after the bridge connected and authed. Query the worker for current status on open and live-listen for reins:status-update, so the pill transitions Connecting… → Connected (and reflects reconnects). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The 30s cap meant a client that climbed its backoff while the server was down could wait up to 30s to reconnect after the server reappeared. Lower the cap to 5s so recovery is prompt for a local-only WebSocket. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The extension could never connect to the MCP server — this branch fixes the root cause, makes the popup honest about status, and adds the logging that surfaced the bug. The full tool loop is now verified end-to-end against a real browser.
Bugs fixed
background.tscalledcreateDocument({ url: "offscreen.html" }), but crxjs emits the file atdist/src/offscreen.html(samesrc/prefix as popup + worker). The bad path 404'd → the offscreen document never loaded → itsonMessagelistener never registered →offscreen:connecthad no receiver ("Could not establish connection. Receiving end does not exist."). The WebSocket was never even dialed. Fixed the path.connectingon submit and never updated, even after the bridge connected and authed. It now polls the worker for status on open and live-listens forreins:status-update, so the pill transitions Connecting… → Connected (and reflects reconnects).Also
feat(mcp): bridge stderr logging — the WS host was silent; added connect/auth/reject/close logging (stderr only, never stdout — that carries MCP). This directly surfaced both bugs above.perf(extension): reconnect backoff cap 30s → 5s — a client that climbed backoff while the server was down could wait up to 30s to reconnect after it reappeared; 5s is prompt for a local-only socket.Verification
lint,typecheck,test,buildall green.list_tabsreturned 11 real tabs,isError: false. Server exposes 14 tools (ping+ the 13 documented).Server log during the successful call:
Follow-ups (not in this PR)
pingis a 14th tool; README documents 13 → doc nit.🤖 Generated with Claude Code