fix: forward MCP tool abort signals#82443
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main visibly drops the MCP SDK Real behavior proof Next step before merge Security Review detailsBest possible solution: Land one narrow MCP cancellation fix with regression coverage, then close the duplicate parallel PR and linked issue through that merge. Do we have a high-confidence way to reproduce the issue? Yes. Current main visibly drops the MCP SDK Is this the best way to solve the issue? Yes. Forwarding the existing SDK What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against f78434985af9. |
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
* fix: forward MCP tool abort signals * test: repair doctor health context fixtures
Summary
AbortSignalwhen dispatchingtools/call.tool.execute(...)instead of observing host cancellation.extra.signalthroughcreatePluginToolsMcpHandlers(...).callTool(...)and intotool.execute(...).Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
tool.execute(...)call.main, using the built MCP plugin tools stdio server over a realStdioClientTransportchild process.dist/mcp/plugin-tools-serve.jswith an injected probe tool, called the tool through an MCP client with an aborting request signal, and compared sideband probe output before and after the patch.run_caccc1747346; sideband showedsignalDefined: true,signalIsAbortSignal: true,abortObserved: true,signalAbortedAtEnd: true.run_388253d140c1onmainat639107b7db559c4d937fdcd05ac7d78a88dc4555; sideband showedsignalDefined: false,signalIsAbortSignal: false,abortObserved: false,signalAbortedAtEnd: false.Root Cause (if applicable)
extra.signal, but the stdio server handler only accepted the request object and droppedextrabefore reaching plugin tool execution.AgentTool.execute(...)already accepts an optionalAbortSignal, so the fix is to preserve the existing dependency contract across the MCP server boundary.Regression Test Plan (if applicable)
src/mcp/plugin-tools-handlers.cancel.test.tstools/call, and the plugin tool receives anAbortSignalthat becomes aborted.User-visible / Behavior Changes
Cancelled MCP plugin tool calls can now be observed by plugin tools through their existing
AbortSignalargument.Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
mainby spawning the built MCP plugin tools stdio server with an injected long-running probe tool.Expected
AbortSignaland observes abort when the MCP client cancels the call.Actual
Evidence
Focused commands run after rebase:
All passed.
Human Verification (required)
mainrepro in Crabbox AWS, patched Crabbox AWS stdio behavior, focused MCP cancellation regression test, touched-file formatting and lint.Review Conversations
Compatibility / Migration
Risks and Mitigations
tool.execute(..., signal)contract; plugins that ignore cancellation keep current behavior.