# Encrypted Codex history recovery — real-app reproduction

Run each revision in a separate checkout, with a fresh `.t3` database, a private isolated `CODEX_HOME`, and `T3CODE_DEV_SEED=0`. Use the same configured Codex API endpoint and credentials on both sides; do not publish them. Copy only authentication into the isolated home and use a minimal config with `model = "gpt-6.1-sol"` and the configured API endpoint. Do not copy existing sessions.

Revisions:
- Base: 2770bf3c61c4d6b7bb1f5d3df74aacf54ac7a159
- Head: 05bc5665b9fdc2f19ec1c85db5c3323671e9afd8

1. `vp i` in each checkout.
2. Create an empty scratch git project with one committed synthetic README. Add it through the CLI:
   `node apps/server/src/bin.ts project add "$PROJECT" --title "Encrypted history recovery" --base-dir .t3`
3. Start the app from that checkout with `T3CODE_DEV_SEED=0 CODEX_HOME="$PRIVATE_CODEX_HOME" T3CODE_ENVIRONMENT_LABEL=Evidence T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=0 node scripts/dev-runner.ts dev --no-seed`. The attached `run-app.py` wraps this command, saves its pairing URL privately, and forwards shutdown signals.
4. Seed the real first turn through the running server:
   `node apps/server/src/bin.ts thread start "$PROJECT" 'What is 17*23? Reason it through, then reply with just the number.' --title 'Encrypted history recovery' --provider codex --model gpt-6.1-sol --wait --json --base-dir .t3`
   Both sides completed with `391`. Each isolated Codex home contained one native rollout with one encrypted reasoning item.
5. `python3 corrupt-history.py "$PRIVATE_CODEX_HOME"` changes one character halfway through that encrypted_content value. No error response is mocked or rewritten.
6. Stop and restart the app. Pair the browser and open the seeded thread by its environment/thread URL. Use a 1440×1000 CSS viewport, device scale 2, dark appearance, with the thread details panel closed.
7. Start recording. Enter `huh` in the composer, submit, and wait for the provider error. Then enter `hello? please just reply ok`, submit, and wait for the terminal result.

The browser was driven through T3 preview tools. Composer input used:

```js
const editor = document.querySelector('[role="textbox"][contenteditable="true"]');
editor.focus();
document.execCommand('insertText', false, message);
// Next browser call, after React updates:
document.querySelector('[aria-label="Submit message"]').click();
```

On base, both messages failed with raw HTTP 400 invalid_encrypted_content for the same item, with one native rollout total. On head, the first message failed with a readable error; the next message created a second native session with portable visible history and returned `ok`. The original T3 thread, model, transcript, and failed turn remained. No automatic retry ran between the two submitted messages.

Stills were captured after blurring the composer and checking two captures taken more than 500 ms apart were pixel-identical. Both recordings were inspected through sampled frame sheets. Runtime evidence contains only synthetic conversation data and selected session metadata; credentials, config, native environment instructions, and private paths are excluded.

The live endpoint returned invalid_encrypted_content during this run, unlike the earlier triage run's thinking_signature_invalid alias. Pending background work and long-history truncation were not exercised.
