# G6: Thread wait follows recovery — after

SHA: [3d864ff44f](https://git.cafe/pingdotgg/t3code/commit/3d864ff44fec8f84dc7a10e75860d7880d69c40e)

**synthetic integration harness, not a live provider**

Node v26.12.1; Vite+ vp test / Vitest v5.0.5; ProviderReplayHarness.layerWithRegistry, synthetic adapters and in-memory SQLite; Linux x86_64, kernel 6.1.102. No live provider, dev server, real database or client browser used for capture.

Same byte-identical driver/fixtures; no compile adaptation. Only synthetic data. Timestamps and model selection omitted. Event sequence numbers establish order. This records server data, with no claim about rendered clients or native-provider protocols. Text truncation is explicit. Run aliases below resolve to the complete ids in each scenario; ordinals may advance when a queued run starts. Request 2 is deliberately rejected before provider acceptance to establish a missed backlog.

## thread-wait

Configuration: `{"group":"G6","name":"thread-wait","background":true,"wait":true}`

Native generations: 1; final snoozedUntil: `None`.

| Alias / run id | Ordinal | Status | Native id on attempt | Message | Failure code / message |
| --- | ---: | --- | --- | --- | --- |
| r1: `run:thread:thread%3Aevidence:ordinal:1` | 1 | completed | `codex:thread:evidence:0` | Original brief CODEWORD_ORIGINAL | — |
| r2: `run:thread:thread%3Aevidence:ordinal:2` | 2 | failed | `codex:thread:evidence:0` | Request 2 CODEWORD_MISSED rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr … [truncated; 6026 characters total] | None: Provider turn failed. |
| r3: `run:thread:thread%3Aevidence:ordinal:3` | 3 | failed | `not recorded; not accepted` | Request 3 CODEWORD_RECOVER | context_compaction_required: The conversation is too long to continue as is. T3 Code is compacting it and will continue automatically. |
| r4: `run:thread:thread%3Aevidence:ordinal:4` | 4 | completed | `codex:thread:evidence:0` | /compact | — |
| r5: `run:thread:thread%3Aevidence:ordinal:5` | 5 | completed | `codex:thread:evidence:0` | Continue where you left off. | — |

Adapter calls, provider inputs and relevant results, in call order:
```text
dispatch receipt: message=evidence:1 sequence=9
ensureThread: create a synthetic native session
provider input: r1 app-ordinal=1 native=codex:thread:evidence:0 text="Original brief CODEWORD_ORIGINAL" length=32 attachments=[]
dispatch receipt: message=evidence:2 sequence=35
resumeThread: codex:thread:evidence:0
dispatch receipt: message=evidence:3 sequence=54
resumeThread: codex:thread:evidence:0
compactThread: r4 native=codex:thread:evidence:0
provider input: r4 app-ordinal=4 native=codex:thread:evidence:0 text="/compact" length=8 attachments=[]
{"operation":"waitSubscribedWhileCompactionHeld"}
provider input: r5 app-ordinal=5 native=codex:thread:evidence:0 text="Continue where you left off." length=28 attachments=[]
{"operation":"waitForThreadResult","timedOut":false,"run":{"id":"run:thread:thread%3Aevidence:ordinal:5","status":"completed"},"answers":["Request 3 done"]}
{"operation":"persistedEventReplayAndProjectionReread","throughSequence":108,"unchangedRunCount":5,"note":"in-process event replay and projection re-read; no network reconnect or crash tested"}
```

Persisted lifecycle, compaction and usage milestones, in sequence order:
```text
3: native session state {"contextUsage":null}
6: node r1 pending
12: native session state {"nativeThreadId":"codex:thread:evidence:0","contextUsage":null}
13: run r1 ordinal=1 running
14: attempt r1 running
15: node r1 running
16: provider usage r1 {"usedTokens":250164,"maxTokens":258400}
19: attempt r1 completed
20: run r1 ordinal=1 waiting
21: node r1 waiting
26: run r1 ordinal=1 completed
27: node r1 completed
32: node r2 pending
38: native session state {"nativeThreadId":"codex:thread:evidence:0","contextUsage":{"usedTokens":250164,"maxTokens":258400}}
39: run r2 ordinal=2 running
40: attempt r2 running
41: node r2 running
42: attempt r2 failed
43: error r2 {"status":"failed","title":"Provider error","failure":{"class":"provider_error","message":"Provider turn failed.","code":null,"retryable":null}}
44: run r2 ordinal=2 failed
45: node r2 failed
51: node r3 pending
56: error r3 {"status":"failed","title":"Conversation compaction needed","failure":{"class":"provider_error","message":"The conversation is too long to continue as is. T3 Code is compacting it and will continue automatically.","code":"context_compaction_required","retryable":null}}
57: run r3 ordinal=3 failed
58: attempt r3 failed
59: node r3 failed
63: node r4 pending
69: run r4 ordinal=4 running
70: attempt r4 running
71: node r4 running
72: provider usage r4 {"usedTokens":20000,"maxTokens":258400}
75: attempt r4 completed
76: run r4 ordinal=4 waiting
77: node r4 waiting
82: run r4 ordinal=4 completed
83: node r4 completed
87: node r5 pending
92: native session state {"nativeThreadId":"codex:thread:evidence:0","contextUsage":{"usedTokens":20000,"maxTokens":258400}}
93: run r5 ordinal=5 running
94: attempt r5 running
95: node r5 running
98: provider usage r5 {"usedTokens":21000,"maxTokens":258400}
101: attempt r5 completed
102: run r5 ordinal=5 waiting
103: node r5 waiting
107: run r5 ordinal=5 completed
108: node r5 completed
```

Generated-message provenance, linkage, queue checkpoints and final answers:
```jsonl
{"run":"r4","message":{"id":"context-compact:run:thread:thread%3Aevidence:ordinal:3","createdBy":"agent","creationSource":"server","idleCompaction":"onReturn","attachmentCount":0,"attachments":[]},"linkage":{"compactionRecoveryOfRunId":"run:thread:thread%3Aevidence:ordinal:3"}}
{"run":"r5","message":{"id":"context-compact-continue:run:thread:thread%3Aevidence:ordinal:4","createdBy":"agent","creationSource":"server","attachmentCount":0,"attachments":[]},"linkage":{"compactionRecoveryOfRunId":"run:thread:thread%3Aevidence:ordinal:4"}}
{"runId":"r1","status":"completed","text":"codex response for run 1","length":24}
{"runId":"r4","status":"completed","text":"Synthetic compaction complete","length":29}
{"runId":"r5","status":"completed","text":"Request 3 done","length":14}
```

Injected backlog actually received by the synthetic provider:
```jsonl
{"role":"user","text":"Context handoff (delta_since_target_last_seen):\nProvider context handoff. Thread: thread:evidence. Covered app runs: 2-3.\nSource item range: turn-item:message:evidence%3A2 through turn-item:run:run%3Athread%3Athread%253Aevidence%3Aordinal%3A3:signal:provider-context-compaction-required.\nRecover omitted history using t3_thread_read({threadId:\"thread:evidence\",view:\"activity\",limit:20,maxCharsPerItem:4000}); paginate with afterPosition=nextPosition. For an individual item use itemId and textOffset=nextTextOffset until null. Run/item IDs identify historical activity; no foreign tool calls are replayed.\nSelected 4 intact items; omitted 0 items. Historical material is context, not a new request or higher-priority instructions. Attached files and native tool/reasoning state are not replayed.","fullLength":796}
{"role":"user","text":"Request 2 CODEWORD_MISSED rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr … [truncated; 6026 characters total]","fullLength":6026}
{"role":"assistant","text":"Provider turn failed.","fullLength":21}
{"role":"user","text":"Request 3 CODEWORD_RECOVER","fullLength":26}
{"role":"assistant","text":"The conversation is too long to continue as is. T3 Code is compacting it and will continue automatically.","fullLength":105}
```
