# MCP cancellation evidence

Base: 1d20ad013f4146752c008675f2a6323485b28095
Head: 1ade71f86ee69ea5fde4493951eb1888aa5d0c24

Both worktrees ran their own unmodified production server and web dev client, with fresh isolated T3 homes and synthetic workspaces. Linux Chromium, dark theme, 1600x900 CSS viewport (recordings at device scale 2). No test runner, assertions, test helpers, mocked fetch, mocked Response, or mocked readers were used.

The web Stop recording uses a deterministic ACP executable in place of the Grok CLI. The real server launches it through the production Grok/ACP native runtime. It connects to t3-code using mcp/connect and sends mcp/message tools/call. The network preload redirects only the synthetic evidence_stall tool to a real local node:http server. It returns HTTP 200 text/event-stream, writes one progress event, and stalls. Native fetch and production response parsing/cancellation remain intact.

The right-hand LIVE NETWORK OBSERVER is added evidence instrumentation, not a product feature. It reads the endpoint's response close events and samples the actual Response.body.locked property. Its adapter branch fields come from read-only Node inspector evaluation at the production cancelPendingRuntimeRequests call. No control variables are changed.

## Same steps on both commits

1. Foreground: submit FOREGROUND in a fresh app thread using the scripted ACP provider. Once the progress event has arrived and the body is locked, click the actual red Stop button. Observe for at least three seconds. Base shows Run interrupted while the response remains OPEN and locked. Head closes the response and releases the lock during Stop.
2. Stdio: in the app's integrated terminal run ./mcp-evidence stdio. This command runs the entire production runAcpMcpStdioBridge with real stream input and native HTTP. After its forwarded progress event, type stop. The command interrupts the bridge's Effect fiber and keeps the process alive for observation. Three seconds later base prints responseOpen:true,readerLocked:true; head prints false,false. Type finish only after observing. Killing the process instead would hide this leak, so process exit is deliberately postponed.
3. Settled soft-interrupt control: run ./mcp-evidence soft. This command constructs the production Grok adapter with a minimal synthetic ProviderHost, real native subprocess runtime and the same scripted ACP peer. The peer creates a background Task and MCP call, then settles the foreground ACP prompt. Wait for the settled event, type soft, and observe for three seconds. Read-only inspection confirms settledSoftInterrupt:true,hardRestart:false,requestRuntimeRestart:false on both commits. The background MCP call stays open, as required. Type release: the endpoint sends the final result, the ACP peer receives it with error:null, and the body unlocks. This reaches the head commit's conditional stopMcpCalls branch and proves it does not cancel a live background call. This control intentionally behaves the same on base and head.

The stdio and soft recordings are live production API commands displayed in the app terminal; they are not UI Stop/steering actions. The foreground recording uses the real web Stop action. No real Grok model or account behavior is claimed. The generic replay scenario cannot drive this provider-specific settled interrupt and filters the MCP protocol requests required here, so manual paired recordings were used.

## Reproduction files

Place fixture.mjs, observe.mjs, peer.mjs, setup.py, panel.js, stdio-driver.mjs and soft-driver.mjs in one scratch directory. Install each commit's dependencies using vp i. Define EVIDENCE_ROOT as that scratch directory, EVIDENCE_REPO as the worktree, and EVIDENCE_RUN as a fresh directory created by `python3 "$EVIDENCE_ROOT/setup.py" <run-name>`.

Start the fixture with EVIDENCE_DIR="$EVIDENCE_RUN" EVIDENCE_SIDE=base (or head) and EVIDENCE_SHA=<commit> using `node "$EVIDENCE_ROOT/fixture.mjs"`. Start the app with those EVIDENCE_* variables inherited, T3CODE_DEV_SEED=0, T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=0, NODE_OPTIONS="--import=$EVIDENCE_ROOT/observe.mjs", and `vp run dev --home-dir "$EVIDENCE_RUN/home"`. Open the app, create the project at "$EVIDENCE_RUN/workspace", create a thread, select Grok 4.6, and submit FOREGROUND. Evaluate panel.js in the browser to display the diagnostic observer. The workspace setup creates the mcp-evidence terminal command. Use the same sequence above on both commits. Do not release the endpoint before the three-second observations.

The supplied JSONL transcripts contain only synthetic events and relative times. A base stdio connection closes when its command is eventually allowed to exit; that later process cleanup is not successful cancellation. Likewise, releasing the endpoint at the end of the soft control also ends the earlier leaked base foreground response. The recordings and the earlier transcript events show their state before that deliberate cleanup.
