-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Chrome MCP pending attach abort can cancel unrelated waiters #88304
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
Chrome MCP cached session creation shares one pending attach promise per profile/cache key, but that shared attach currently uses the first caller's
AbortSignal. If that first caller cancels while another caller is waiting for the same attach, the shared pending promise can reject with the cancelled caller's reason and the unrelated caller fails too.That can make concurrent browser operations flaky around timeouts/cancellations: one abandoned request can cancel another request that still wants the same Chrome MCP session.
Source evidence
On current
origin/main(b0d6076208193231da906244abf2fdc1d88a2ccf):extensions/browser/src/browser/chrome-mcp.ts:843starts the shared cached-session path when no cached session exists.extensions/browser/src/browser/chrome-mcp.ts:846creates a sharedpendingpromise.extensions/browser/src/browser/chrome-mcp.ts:847passes the caller'ssignalintocreateChromeMcpSession(...)for that shared pending attach.extensions/browser/src/browser/chrome-mcp.ts:857toextensions/browser/src/browser/chrome-mcp.ts:863makes every concurrent caller await that samependingpromise.extensions/browser/src/browser/chrome-mcp.ts:813toextensions/browser/src/browser/chrome-mcp.ts:824closes/rejects the created session when that signal aborts.Reproduction shape
Use
setChromeMcpSessionFactoryForTestwith a gated fake Chrome MCP session:listChromeMcpTabs("chrome-live", undefined, { signal })and keep the factory unresolved.listChromeMcpTabs("chrome-live")for the same profile.Current behavior: both calls reject with the first caller's abort reason.
Expected behavior: the first call rejects, but the second call keeps waiting on the attach and succeeds. If every waiter cancels, the pending attach should be torn down and a later caller should start fresh instead of joining a cancelled pending session.
Proposed fix
Track shared pending Chrome MCP attaches as a small state object with waiter count and an internal abort controller. Caller aborts should release only that caller's wait. The shared attach should be aborted/closed only when the last waiter cancels, and the pending entry should be evicted before teardown so fresh callers cannot join a doomed attach.
Regression tests / proof to add
Add focused coverage in
extensions/browser/src/browser/chrome-mcp.test.tsfor:session.readyis still pending;I searched for existing issues/PRs with
Chrome MCP pending session abort signal waiterandchrome-mcp pendingSessions createChromeMcpSession abort signal; no overlapping issue or PR showed up.