# Usage archive reproduction

Environment: web development app, Chromium 157, 1280 x 800 CSS pixels, device pixel ratio 2, light appearance. Missing-directory and unreadable-directory stills use 1280 x 900 on both sides to keep the full table visible. Each commit has a fresh T3 home and isolated user home. No provider calls or credentials.

Run `node manual-driver.mjs <checkout> <new-run-directory> <web-port> <server-port>` separately for each commit. The driver records process IDs for cleanup and creates standard synthetic Codex JSONL: active = 2,000 input + 1,000 output; archived = 2,000 input + 5,000 output. Both are timestamped yesterday. The archived rollout is already in archived_sessions before the first scan.

Create a git workspace and register it with `node apps/server/src/bin.ts project add <workspace> --title "Usage demo" --base-dir <run-directory>/t3`. Open the startup pairing link and wait for the signed-in project view. Open /usage, select Tokens, 7 days, and only Codex.

Record this exact sequence on each side:
1. Refresh Usage, await aria-busy=false, capture initial.
2. `node manual-steps.mjs <run-directory> copy`; refresh, await completion, capture copy.
3. `node manual-steps.mjs <run-directory> move`; refresh, await completion, capture move.
4. `node manual-steps.mjs <run-directory> missing`; refresh, await completion, capture missing.
5. `node manual-steps.mjs <run-directory> unreadable`; refresh, await completion, capture unreadable, then run restore to reset permissions.

Before each retained still, compare two screenshots taken at least 500 ms apart using ImageMagick's pixel comparison; retain only a pair with zero differing pixels.

Observed on base 31eea883c7f7849ada6eb49265cb11fc64d2ecbd: all four stages show 3K processed tokens and one session; the archive-only session is absent. Previously scanned active usage remains cached after the move and missing-directory steps.

Observed on fix 58de4b373300923002a0b429e54954557b40b744: all four stages show 10K processed tokens and two sessions; copies and moves do not change the total. Removing the active directory additionally shows "Active transcript directory is missing; usage may be incomplete." while preserving cached usage. Making the archive directory unreadable likewise preserves 10K and two sessions and reports "1 transcript path(s) could not be read; usage may be incomplete."

Cleanup: send SIGTERM to only the process groups recorded in pids.json. No application source was changed. The archive state was seeded as standard JSONL; Codex's own archive command was not exercised.

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