Skip to content

Bound MCP tool calls and environment setup commands - #16219

Merged
seemeroland merged 3 commits into
masterfrom
roland/mcp-stall-diagnostics
Oct 2, 2026
Merged

seemeroland merged 3 commits into
masterfrom
roland/mcp-stall-diagnostics

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Upgrade rmcp and bound MCP tool calls and environment setup so unresolved operations cannot consume the full sandbox lifetime. The investigation found missing MCP results after broken response streams and unfinished setup iterations.

  • Upgrade rmcp from 2.2.0 to 3.5.0, picking up upstream request-scoped error propagation when an SSE response terminates without a final result after supported recovery. The fix shipped in the 3.0 release line via rust-sdk#1000; no dependency fork is needed. Adapt OAuth metadata discovery, authorization requests, and client configuration to the 3.5 APIs.
  • Native MCP tool calls have a 30-minute total connection/dispatch/response budget, plus at most five seconds for best-effort cancellation. Timeout errors distinguish undispatched calls from unknown remote outcomes.
  • Do not automatically replay tools after ambiguous TransportClosed failures. Warp resource-read retries remain unchanged; tests verify valid SSE resumption still succeeds.
  • Each configured environment setup command has a 30-minute budget. Directory reset has a separate 30-second budget. Failures identify the command index and unconditionally redact known secrets.
  • Setup timeouts skip further terminal cleanup commands and live failure retention, while preserving postmortem session history. Add payload-free lifecycle diagnostics.

The MCP limit also applies to local native-agent sessions. These fixed limits can interrupt legitimate longer operations. Cancellation is best-effort and does not prove that the remote tool stopped.

Terminated response streams can fail without waiting for the 30-minute logical deadline. That deadline remains a safety net for calls that stay pending, including stalled connection or dispatch. wait_for_events and parent orchestration behavior are unchanged.

Screenshot 2026-09-30 at 4 33 07 PM

Review guide

Start with Cargo.toml and the 3.5 compatibility changes in crates/mcp/src/oauth.rs and runtime.rs. Then review tool_call.rs for the total deadline and bounded cancellation, followed by the setup timeout/teardown paths in driver/environment.rs and driver.rs. Focus on prompt EOF failure versus deadline fallback, valid resumption without tool replay, command redaction, and avoiding renewed waits during cleanup.

Companion server diagnostics: https://github.com/warpdotdev/warp-server/pull/18729

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement — no separate issue was created; investigation linked below.
  • Screenshots or a short video are included where appropriate — no visual/UI changes.

Testing

Manually tested setup command timeout
Screenshot 2026-09-30 at 5 11 38 PM

Validation during the rmcp upgrade

  • cargo nextest run -p mcp passed: 40 tests, including OAuth, deadline, EOF and resumption coverage.
  • cargo check -p mcp --tests and cargo check -p warp --tests passed.
  • cargo clippy -p mcp --all-targets --tests -- -D warnings passed.
  • The MCP crate was formatted with repository settings; git diff --check passed.
  • A standalone HTTP reproducer confirmed that empty SSE and progress-then-EOF responses leave calls pending in rmcp 2.2.0. The same cases return TransportClosed in released 3.0.0 and current upstream; successful-result controls pass in all three.

Earlier deadline validation

Recorded before the dependency upgrade:

  • 107 focused tests passed: cargo nextest run --locked --lib --no-fail-fast -p warp -p mcp -E 'package(mcp) | test(setup_) | test(shell_exit_) | test(extend_shared_session_retention)'.
  • cargo check --locked -p warp --lib --tests passed.
  • cargo clippy --locked -p warp -p mcp --lib --tests -- -D warnings passed.
  • Changed Rust files were formatted with repository settings; git diff --check passed.

Coverage includes empty/truncated SSE responses failing with the logical deadline disabled, successful SSE results followed by EOF, wrong-response-ID deadline fallback, valid resumption, concurrent calls, and bounded cancellation. Controlled-future setup tests cover start/exit waits, redaction, error classification, and retention bypass.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: MCP tool calls fail when a response stream ends without a result and time out instead of waiting indefinitely for unresponsive servers.
CHANGELOG-OZ: Cloud runs report which environment setup command timed out instead of waiting until the sandbox expires.

Context

Co-Authored-By: Warp agent@warp.dev

Add a 30-minute logical MCP deadline with bounded cancellation and no ambiguous transport replay. Bound setup commands, report redacted command-specific failures, and retain postmortem history without keeping stalled processes alive.

Co-Authored-By: Warp <agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Sep 30, 2026
@seemeroland
seemeroland marked this pull request as ready for review September 30, 2026 23:34
@seemeroland
seemeroland merged commit d5d23e6 into master Oct 2, 2026
52 of 54 checks passed
@seemeroland
seemeroland deleted the roland/mcp-stall-diagnostics branch October 2, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant