# Stop history performance evidence

This driver exercises a running T3 Code server, not a test harness or an in-process orchestrator fixture. It uses the server's authenticated public WebSocket RPCs, its normal file-backed SQLite database, and the repository's Replay (dev) ACP agent. The driver's SQLite connection is read-only and is used only to observe completion and verify behavior.

## Reproduce

Use a checkout of each commit, with `vp i` completed in each. Copy `stop-proof.ts` to `apps/server/scripts/zz-stop-proof.ts` in both checkouts. Run from each checkout root, on the same Linux machine. Use separate empty data directories and free ports for each server.

Start each real server, with its own data directory:

```sh
T3CODE_DEV_SEED=0 node apps/server/src/bin.ts --base-dir DATA_DIR --port PORT --host 127.0.0.1 --dev-url http://127.0.0.1:PORT --no-browser
```

Wait until the server reports `Listening` and finishes startup migrations before issuing credentials or running the driver. Keep authentication output private.

Create 5,000 completed runs through the app's own `message.dispatch` RPC, each completed by the existing `multi-turn` replay recording:

```sh
node apps/server/scripts/zz-stop-proof.ts DATA_DIR http://127.0.0.1:PORT UNIQUE_SEED_OUTPUT_DIR 5000 36 seed
```

Seeding can run concurrently on the two sides; finish all seeding before measurements. The driver keeps a synthetic thread manifest inside DATA_DIR so the measurement uses that same history.

Measure serially in base / head / head / base order, with a new timestamped output directory on every invocation:

```sh
node apps/server/scripts/zz-stop-proof.ts DATA_DIR http://127.0.0.1:PORT UNIQUE_ROUND_OUTPUT_DIR 5000 36 measure
```

Each invocation runs four warmup pairs, then 36 measured pairs. A pair alternates `thread.stop` and `run.interrupt` with `holdQueue: true`, each against a fresh run with a live provider turn. Active turns use the repository's existing `bench-stream` replay recording.

The measured interval is the authenticated WebSocket RPC request through its acknowledgement. Afterwards, the driver checks that a `run_interrupt_request` was persisted for the targeted run and waits for that run to reach `interrupted`. The next sample starts only after that terminal state. Provider shutdown is outside the timed interval; there are no delegated tasks in this fixture. All samples and warmups must pass these behavioral checks, otherwise the driver stops with an error.

The history remains 5,000 completed runs; each measurement invocation adds 80 interrupted runs (8 warmups and 72 measured actions). The same accumulation occurs on each commit. The two rounds per side therefore expose run-to-run variation as well as within-round spread.

`render-evidence.py` reads the four round output directories, verifies their recorded behavior flags, and produces the before/after text transcripts, PNG summaries, and comparison JSON. No timings are synthesized.

```sh
python3 render-evidence.py REPORT_DIR BASE_ROUND_1 HEAD_ROUND_1 HEAD_ROUND_2 BASE_ROUND_2
```

This is an end-to-end server RPC measurement using file-backed SQLite. It is not the reported in-memory orchestrator-only benchmark, so its absolute latencies include additional transport and server-service overhead.
