# Stopped JSON MCP response reproduction

Run on Linux with this repository's scenario runner and ghdrop installed.

The scenario drives the real web client at 1280×800 in its default light theme. Each commit runs its own server and fresh synthetic project/thread state. The temporary replay-agent extension sends a real ACP `mcp/connect`, initialization, and `mcp/message` containing `tools/call` for `t3_project_list`.

`observe.mjs` redirects only HTTP MCP `tools/call` fetches to `gate.mjs`. The gate forwards the authenticated request to the actual T3 MCP endpoint, reads its successful response, then sends application/json headers and all but the final response byte over a real HTTP connection. The production response reader receives the native fetch Response unchanged. The observer samples only `response.body.locked`; it never acquires, cancels, or releases a reader.

The fixture waits until the native reader is locked, then the scenario clicks Stop generation in the web client, waits for it to disappear, and asks the endpoint to attempt a late body write after a one-second observation window. The screenshot panel is explicitly a fixture observer, populated from the endpoint state; it is not shipped T3 UI.

On the base, the connection remains open, the reader remains locked, and the late write callback succeeds. On the head, the endpoint receives close, the reader is unlocked, and late bytes cannot be written to that closed response. The scenario asserts exactly those three values.

## Run

Put `stopped-json-mcp.e2e.ts` under `scripts/scenarios/` in a checkout of current main. Keep `gate.mjs` and `observe.mjs` together in a separate fixture directory. From the repository root, run `vp i`, then start `node <fixture-directory>/gate.mjs` in a terminal. In another terminal run:

```sh
T3CODE_DEV_SEED=0 \
T3_PROOF_GATE=http://127.0.0.1:18925 \
NODE_OPTIONS="--import=<absolute-fixture-directory>/observe.mjs" \
T3_SCENARIO_INHERIT_ENV=T3CODE_DEV_SEED,T3_PROOF_GATE,NODE_OPTIONS \
vp run scenarios:prove scripts/scenarios/stopped-json-mcp.e2e.ts \
  --base 9bc3fda0ac28020977c8adc89422c2d6c6c0e907 \
  --head d326376f7b82080b1e5ea64bfc9248c798afd7e6 \
  --upload-command 'ghdrop upload'
```

Stop the gate afterwards. The scenario restores its temporary replay-agent edit in a finally block. No production cancellation code is changed by the fixture.
