# Codex cumulative-counter rewind: browser proof

Two separate checkouts run the real web client and server:
- Base: 7fab4ef97838e3e0f1b7e0e2af58d778fda059d8
- Fix: 0b65fdfc533e4c7c38a9c8cfa3bf3f5560b6efd0

Install each checkout with `vp i`. Run `python3 seed.py <scratch-root>` once.
The seed creates fresh base/head/recovery T3 homes and one synthetic Codex source.
It disables real providers, points Codex explicitly to that source, and supplies a generic environment label.
The issue's timestamps and token counters are unchanged. Its model label is replaced with `synthetic`, so pricing is intentionally unavailable; this proof concerns processed tokens.

For each side, launch from its checkout:

```bash
HOME="<scratch-root>/<side>" PATH="<scratch-root>/bin:$PATH" \
T3CODE_DEV_SEED=0 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=0 \
vp run dev --home-dir "<scratch-root>/<side>"
```

Pair a browser using that server's startup link, finish welcome, and open `/usage`.
Select Tokens, 30 days, and filter providers to Codex.
All retained captures use Chromium, a 1440 x 1000 CSS viewport, and the light theme.
Wait until scanning is finished. Two screenshots at least 500 ms apart must match pixel-for-pixel.

Observed: base shows 1.67K (1,400 input + 270 output) and one skipped-record warning.
Fix shows 1.91K (1,600 input + 310 output), with no warning.

For cache recovery, before starting a third fresh head app, copy only base's
`userdata/usage-scan-cache-v14.json` into recovery's `userdata/`.
Start the fix with `--home-dir <scratch-root>/recovery` and a different `T3CODE_PORT_OFFSET`.
Repeat the same Usage view. It shows 1.91K with no warning and writes a recovered cache containing four records, zero malformed.
The rollout was unchanged in bytes and mtime throughout cold-cache and recovery checks.
Its SHA-256 was c447c6530f0aee990240232e8450a66aa2532bece4445edb8c9a033a25f5d62a.

For subsequent reconciliation, start each side from the original attached rollout.
While recording Usage, run:

```bash
python3 append-request.py <scratch-root>/codex/sessions/rollout.jsonl
```

Click Refresh usage. The appended request contains 50 input + 10 output tokens,
with cumulative counters 1,350 input + 270 output, continuing from the rewound baseline.
Base changes 1.67K -> 1.73K and retains one warning.
Fix changes 1.91K -> 1.97K, without a warning.
The original rollout was restored before repeating the append-and-refresh interaction on the other side.

AI-assisted; verified with the tests and tools listed above.
