[v0.8 MCP 8] close late probe sessions - #1338
Open
sethkarten wants to merge 2 commits into
Open
Conversation
Reconstruct the unique net delta from PR #1266, excluding propagation merges.
This was referenced Aug 13, 2026
jonaowen
suggested changes
Aug 13, 2026
jonaowen
left a comment
There was a problem hiding this comment.
The late-open cleanup mechanics are mostly sound, but three contract blockers remain.
- The probe accepts a caller-supplied
trusted: trueboolean. The exact stack base already mints and validates opaqueProjectMcpDeclarationAdmissioncapabilities; a boolean is forgeable and does not prove the declaration passed that boundary. Consume/validate the opaque admission or a provenance-bound trusted snapshot, and test forged, released, and stale admission. - The 2025-03-26 handshake is not protocol-valid.
clientInfolacks requiredversion, the client never sends mandatorynotifications/initializedbeforetools/list, the transport cannot express notifications, and the untyped initialize result/protocol version is ignored. Add notification support, valid client metadata, negotiated-version validation, and exact lifecycle/payload tests. mcp testremains advertised by malformed-command usage fromparseMcpDeclarationCommand()even though registry help removes it and the exact public spelling is rejected. Separate public usage from the retained internal parser (or remove the internal spelling) and test malformed public MCP invocations.
The deadline rejection, late-open handlers, redaction, and timer cleanup do not show an immediate unhandled-rejection defect, but they cannot cure these authority/protocol blockers.
This was referenced Aug 14, 2026
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.
Replacement scope
This PR reconstructs and supersedes the unique implementation delta reviewed in #1266 without rewriting that historical branch. The original PR remains the immutable discussion record: #1266
v080/mcp-split-m5-project-trustv080/mcp-split-m8-probe-boundariesbba4f89774eb8cca21db081b1314e7c3d6602ba377b188b92dc91365cb2bc41bdb46a50669d104a8) is the shared foundation. For reconstructed deltas it is a proven tree-compatible base, not an ancestry claim about the historical PR stack.Validation
tsgo --noEmit: passNo original PR was retargeted, closed, merged, or otherwise mutated.
Note
Medium Risk
Introduces MCP endpoint probing with timeout/cleanup semantics and redacts errors to avoid credential leaks; public
mcp testbehavior changes to always fail before settings access.Overview
Adds
runMcpDeclarationProbeinmcp-probe.ts: a read-only MCP handshake (initialize→tools/list) over an injected transport only, with disabled/offline/trust guards, 1–10s timeouts, generic redacted errors (no URL/credential leakage), and always-on session cleanup—including closing sessions whoseopenresolves after the deadline, with optionalonLateCleanupFailurefor late close failures.Public CLI change:
mcp testis removed from help/registry and rejected immediately inpublic-command.ts(before parsing or settings), so probing stays an internal injected-executor path; declarationteststill returns the offline preview via existing command execution (tests unchanged for legacy transport injection).Tests cover handshake shape, guard rails, redaction, late open/close, and fractional timeout floors.
Reviewed by Cursor Bugbot for commit 09faec9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Close late MCP probe sessions and remove
mcp testfrom public CLIrunMcpDeclarationProbein mcp-probe.ts: a bounded, read-only MCP handshake over an injected transport that runsinitializethentools/list, redacts all transport/protocol errors, and guarantees session cleanup even whenopenresolves after the timeout deadline.onLateCleanupFailurecallback rather than swallowed silently.mcp testfrom the CLI: the subcommand spec is deleted from the registry andrunMcpDeclarationCommandrejects immediately if the first argument is'test'.mcp testnow receive an error before any settings access.Macroscope summarized 09faec9.