# Stalled preview capture proof

Surface: web app, real Node server and real server-hosted Chromium, 1280 x 800, light theme. Each side starts with a fresh database. The repository's Replay question recording keeps an agent run active; no paid or substitute provider is used. Projects and threads are created through public server APIs and CLI commands.

The Browser panel displays a local page containing the driver's live observations. These are actual MCP results and observer deadlines, not expected results. Target tabs use a separate local page whose heading is "Capture target ready". Both before and after screenshots and videos capture the whole real web app through the scenario runner, using the same capture path.

## Run

Place `stalled-preview-capture.e2e.ts` in `scripts/scenarios/` in a checkout of main with the scenario runner. Place `fault.cjs` in a new scratch directory. Install dependencies with `vp i`.

```sh
export PROOF_ROOT="$(mktemp -d)"
cp fault.cjs "$PROOF_ROOT/fault.cjs"
export NODE_OPTIONS="--require=$PROOF_ROOT/fault.cjs"
export T3CODE_DEV_SEED=0
export T3_SCENARIO_INHERIT_ENV=NODE_OPTIONS,PROOF_ROOT,T3CODE_DEV_SEED
vp run scenarios:prove scripts/scenarios/stalled-preview-capture.e2e.ts --base 772bc61c01e78f4afb8cce86d74f12e89a8b8c72 --head ed996706b2eb437ef48e41169ae14b1e52b01c56
```

The preload records the test thread's MCP credential privately in scratch, so do not upload that credential file. It intercepts live Playwright objects without changing repository source. Every intercepted command is first sent to the real browser. The injector then withholds promise completion, simulating an unanswered acknowledgement. It provides no invented browser or provider responses.

## Identical cases on both commits

For each case, open a fresh target tab and take a successful baseline snapshot with its heading. Attach a preview-stream WebSocket for viewer cases; start an actual browser recording for recording cases.

1. Withhold one viewer `Page.stopScreencast` completion; request a snapshot, turn off injection for new commands, detach the viewer, request another snapshot.
2. Repeat with one viewer `Page.startScreencast` completion withheld.
3. Repeat with a recording's `Page.stopScreencast` completion withheld; the recording remains active for the follow-up snapshot.
4. Repeat with a recording's `Page.startScreencast` completion withheld.
5. Withhold the final recording stop completion, and withhold detach and encoder-close completions when cleanup is attempted. Stop the recording, turn off injection for new calls, and request a snapshot. The fixed side must return the explicit recording-discard error and allow the snapshot.
6. Allow final screencast stop to acknowledge, but withhold detach and encoder-close completions. Stop the recording, then request another snapshot.

Already-held promises stay unanswered throughout these checks. Turning injection off only makes later calls healthy. All held promises are released at teardown.

Snapshots have their normal 15-second server budget (plus response grace). Recording stop normally has a 120-second tool budget; the driver stops observing an unanswered call at 17 seconds and explicitly reports "NO RESPONSE". That observation is not represented as a server-returned timeout. The subsequent snapshot then tests whether the tab's capture lock remains held.

The six assertions check snapshot recovery (including the target heading), the explicit discard error for a stalled final stop, and completion of ordinary stop despite stalled cleanup. The videos show the live results accumulating; the final stills show all cases together. JSON transcripts preserve actual tool results and timings; fault events show precisely what was withheld.

The uploaded MP4s preserve real-time pacing. They trim the initial setup and post-result teardown, then hold the final recorded frame for three seconds. No result text is added to a capture. The PNGs are unmodified whole-app screenshots.
