Skip to content

fix(mcp): close late probe sessions - #1266

Closed
sethkarten wants to merge 15 commits into
core07-lifecycle-teardownfrom
core08-mcp-probe-boundaries
Closed

fix(mcp): close late probe sessions#1266
sethkarten wants to merge 15 commits into
core07-lifecycle-teardownfrom
core08-mcp-probe-boundaries

Conversation

@sethkarten

@sethkarten sethkarten commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Close an injected MCP session even when transport open resolves after the probe deadline.
  • Use independently bounded cleanup and report only redacted late-cleanup failures.
  • Keep public MCP commands declarative; probing remains an injected boundary capability.

Validation

  • Biome scoped check passed for the five changed source/test files.
  • Scoped MCP probe test passed: 9 tests.
  • git diff --check passed.

Not run: root tsgo --noEmit is unavailable in this checkout. The scoped public/declaration suites cannot load because workspace dependencies are absent.

Note

Fix MCP probe to close sessions that resolve after the deadline

  • Implements runMcpDeclarationProbe in mcp-probe.ts with injected transport, enforcing trust/offline guards, bounded timeouts, and guaranteed session cleanup.
  • Sessions that open after the deadline has elapsed are closed asynchronously; failures during late cleanup are reported via an onLateCleanupFailure callback rather than thrown.
  • All errors are redacted to generic public messages via publicProbeError to avoid leaking endpoint or transport details.
  • Removes mcp test from the public CLI command, throwing immediately if invoked in that context.

Macroscope summarized fb70146.

Final reconciled validation

  • Head: 4af99680b698918cd14981d506fcd14804cc1f81
  • Core-08 reconciled with final Core-07 parent; injected-only probe boundary preserves late-open eventual cleanup while the public command stays unavailable.
  • Non-writing Biome over the full Core-05–Core-09 changed-path union: pass (29 files)
  • Root tsgo --noEmit: pass
  • Configured MCP, lifecycle, catalog, and registry regressions: 16 files, 293/293 tests pass under sanitized RLM_/PRIME_AGENT_ environment
  • git diff --check: pass; final worktree clean

Note

Medium Risk
Changes MCP trust/error-handling boundaries and session lifecycle; scope is limited to probe plumbing and CLI surface, with redaction and tests.

Overview
Adds runMcpDeclarationProbe as an internal, injected-transport handshake (initialize then tools/list) with bounded timeouts, generic error messages (no URL/credential leakage), and cleanup of sessions that open after the deadline via onLateCleanupFailure.

Public CLI no longer documents or accepts mcp test; it fails before MCP parsing or settings access. Help text for mcp is updated to match declarative-only commands.

Reviewed by Cursor Bugbot for commit fb70146. Bugbot is set up for automated code reviews on this repo. Configure here.

# Conflicts:
#	packages/coding-agent/src/cli/command-registry.ts
#	packages/coding-agent/src/core/mcp/mcp-probe.ts
#	packages/coding-agent/test/mcp-probe.test.ts
@sethkarten
sethkarten marked this pull request as ready for review August 12, 2026 00:55
@sethkarten
sethkarten force-pushed the core08-mcp-probe-boundaries branch from 3a1d93b to 91bce62 Compare August 12, 2026 18:35
Comment thread packages/coding-agent/src/core/mcp/mcp-probe.ts Outdated
@sethkarten

Copy link
Copy Markdown
Contributor Author

Superseded by #1338 as part of the physical Core/MCP stack split. The replacement preserves this PR’s reviewed semantic delta on the corrected shared #1243 foundation. Closing this PR to avoid duplicate review; branch retained for provenance.

@sethkarten sethkarten closed this Aug 13, 2026
xsyetopz pushed a commit to xsyetopz/prime-agent-next that referenced this pull request Aug 15, 2026
Reconstruct the unique net delta from PR PrimeIntellect-ai#1266, excluding propagation merges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant