Repository navigation
Conversation
The MV3 service worker restarts constantly and re-runs remote MCP reconciliation on every wake. A server that rejects the configured credential (HTTP 401/403) was re-attempted forever at that cadence, hammering remote endpoints around the clock. Auth rejections now record an exponential backoff (1min doubling to a 30min cap) in chrome.storage.session, so it survives worker restarts but never outlives the browsing session. While a window is active the connection attempt is skipped and the server status explains when the retry happens. Editing the server URL or auth token retries immediately, a successful connection resets the state, and storage failures fail open. Non-auth failures keep the existing behavior.
igrigorik
added a commit
that referenced
this pull request
Aug 28, 2026
The service worker wakes on every navigation in any tab, and module top
level called loadRemoteTools(), so ordinary browsing with the sidebar
closed reconnected to every configured MCP server on every page load.
A stale token made that an unbounded 401 loop paced by browsing.
Discovery was eager because the catalog had nowhere to live: it was held
only in worker memory, which dies after ~30s idle, so every wake had to
rebuild it by connecting. Simply making discovery lazy would have moved
the cost rather than removed it, because stream start blocks on tool
readiness -- a cache miss is first-token latency, not background work.
Cache the catalog in chrome.storage.session and materialize it as a
dormant RemoteMCPSession: a real session carrying cached capabilities
with no live client, so hasContext stays true and a stream still
attaches its revocation listener against the same object-identity
authority anchor. Servers are contacted on first tool call.
- discover on intent only: sidebar load warms, stream start ensures
- bound discovery with a 5s timeout; tool calls keep the SDK default,
since a slow tool is working rather than failing to answer
- negatively cache a failed discovery for 60s so one outage does not
suppress tools for the whole browser session
- refresh writes the cache and never publishes, so it cannot abort a
live turn; the next materialization picks it up
- Options "Test connections" also forces a refresh, always against
saved configuration so a draft under test cannot become authority
Supersedes #16, which backs off auth failures across worker restarts:
correct mitigation at the wrong layer, and coupled to an SDK internal
that changes as soon as an authProvider is configured.
Owner
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.
The MV3 service worker restarts constantly and re-runs remote MCP reconciliation on every wake. A server that rejects the configured credential (HTTP 401/403) was re-attempted forever at that cadence, hammering remote endpoints around the clock.
Auth rejections now record an exponential backoff (1min doubling to a 30min cap) in chrome.storage.session, so it survives worker restarts but never outlives the browsing session. While a window is active the connection attempt is skipped and the server status explains when the retry happens. Editing the server URL or auth token retries immediately, a successful connection resets the state, and storage failures fail open. Non-auth failures keep the existing behavior.