Skip to content

fix(mcp): keep shared optional providers open across discarded probes - #2205

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2195
Oct 12, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2195

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

startMcpTransport loads the optional observation providers once per process and spreads them into every server instance the SDK constructs. createServer's closeProviders also closed options.browserScenarioCapture, a provider the instance did not create. A client can open with server/discover and then fall back to a legacy initialize. The SDK then discards the probe instance, and closing it closed the process-wide browser scenario provider. Every later capture_browser_scenario call on that server process failed within milliseconds with cleanup_incomplete / "Browser scenario provider is closing."

Ownership now follows creation:

  • createServer no longer closes the caller-supplied browser scenario provider. The per-instance services it creates itself are still closed as before.
  • startMcpTransport returns closeOptionalProviders, and createShutdown registers it next to closeAndroid, so the shared provider is closed once at process shutdown.

Fixes #2195

Reproduction (raw JSON-RPC over rea mcp stdio, scenario with a nonexistent executable_path so no browser is needed)

before  legacy-only        call 3,4: execution_failure (launch attempted)
before  probe-then-legacy  call 3,4: cleanup_incomplete "Browser scenario provider is closing."
after   legacy-only        call 3,4: execution_failure (launch attempted)
after   probe-then-legacy  call 3,4: execution_failure (launch attempted), same as legacy-only

Validation

  • New tests/boundary/process/browserScenarioProbeLifecycle.test.ts mirrors the existing Android discovery-probe test. It constructs a probe server, closes it, constructs the replacement, and asserts that the shared provider's close is not called; transport.closeOptionalProviders() then closes it once. It fails on main (close called twice) and passes with this change.
  • Existing shutdown, androidAnalysisMcp, browserScenarioMcp, browserScenarioCleanup and optionalProviderIsolation tests pass.
  • npm run lint passes.
  • npm test: 9184 passed, 14 failed in 7 files. These are the same environmental files that fail on clean origin/main on this host: Hopper not installed, Command Line Tools only (ibtool), hdiutil, and inspector target-location cases.
  • Not run: a real browser scenario. This macOS host has no Chrome/Chromium, so the reproduction only checks that the call reaches browser launch again instead of being rejected as closing.

🤖 Generated with Claude Code

startMcpTransport loads optional observation providers once per process
and passes them to every server instance the SDK constructs. Each
instance's closeProviders also closed the shared browser scenario
provider, so when the SDK discarded a server/discover probe instance for a
legacy initialize, every later capture_browser_scenario call failed with
"Browser scenario provider is closing." Server instances no longer close
the caller-supplied provider; the transport returns
closeOptionalProviders and process shutdown closes it once.

Fixes #2195

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T13:55:18.947698Z 71597db PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kaoru0822-kitauji
kaoru0822-kitauji merged commit 7c9c1eb into main Oct 12, 2026
32 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/issue-2195 branch October 12, 2026 13:56
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the area: mcp MCP server, transport, and tool registration label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP stdio: capture_browser_scenario fails permanently with "Browser scenario provider is closing." after a discarded server/discover probe

2 participants