# Browser renderer crash evidence

Run from a current main checkout with dependencies installed. Copy the two downloaded scenario files into `scripts/scenarios/`; both import the repository's `t3.ts` fixture. Neither changes application code. Both use fresh server state, one synthetic project and one replay thread, Chromium at 1280x800, and the default light theme.

The badge scenario serves exactly the issue's index.html and sw.js over loopback port 8765. Run:

```sh
T3CODE_DEV_SEED=0 T3CODE_SERVER_BROWSER_SANDBOX=0 \
T3_SCENARIO_INHERIT_ENV=T3CODE_DEV_SEED,T3CODE_SERVER_BROWSER_SANDBOX \
vp run scenarios:prove scripts/scenarios/service-worker-badge-retains-tab.e2e.ts \
  --base 9efd960925f0899c0a6d045d128557c5d82818e8 \
  --head 2401baec77ddf46a9a2fe0e1aa7c195ea9cc2b6e
```

The renderer scenario also exercises the crash recovery that the badge prevention would otherwise mask. Download `expose-browser-cdp.cjs` to a scratch directory and set `EVIDENCE_SCRATCH` to that directory's absolute path. The preload observes the replay subprocess's own MCP credential and writes it privately with mode 0600; it is used only to call the real server's MCP endpoint for that synthetic thread. It also adds a loopback debugging port to the server browser's normal Chrome launch. It does not change app code, simulate crash events, replace the browser, or change badge handling. The scenario sends Chrome's `Page.crash`, awaits the actual Playwright crash event, captures the app, calls `preview_status`, and presses Reload in the UI. An observational WebSocket wrapper records preview-stream close codes and reasons.

```sh
T3CODE_DEV_SEED=0 T3CODE_SERVER_BROWSER_SANDBOX=0 \
ISSUE21022_CREDENTIAL_FILE="$EVIDENCE_SCRATCH/agent-credential.json" \
ISSUE21022_OUTPUT="$EVIDENCE_SCRATCH" \
NODE_OPTIONS="--require=$EVIDENCE_SCRATCH/expose-browser-cdp.cjs" \
T3_SCENARIO_INHERIT_ENV=T3CODE_DEV_SEED,T3CODE_SERVER_BROWSER_SANDBOX,NODE_OPTIONS,ISSUE21022_CREDENTIAL_FILE,ISSUE21022_OUTPUT \
vp run scenarios:prove scripts/scenarios/renderer-crash-retains-tab.e2e.ts \
  --base 9efd960925f0899c0a6d045d128557c5d82818e8 \
  --head 2401baec77ddf46a9a2fe0e1aa7c195ea9cc2b6e
```

Ports 8765 and 19222 must be free. The sandbox opt-out only works around the VM's AppArmor policy. No real account or paid model is needed. Never upload the private credential file. Published transcripts contain only responses about the synthetic browser page.
