mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## Why Resuming a compacted thread should use the compaction and its newer records without depending on older turn contexts or restoring stale state from before the compaction. ## What changed - Stop paginated model-context scans at the newest compaction with `replacement_history` and `window_number`. Fall back to full replay if the newest compaction lacks either field. - Align reconstruction with that boundary and restore `last_started_turn_id`, previous turn settings, and the multi-agent version from compaction resume metadata. Allow newer completed turns to override the saved settings. - Keep canonical session metadata alongside the bounded replay and use the same scan boundary for subagent rollout migration. ## Testing Add coverage for cold resume after mid-turn compaction, bounded/full replay equivalence, missing companion state, settings precedence, and incomplete-compaction fallback. GitOrigin-RevId: f836464bb5cadd9be4a4e05b5d1679223713fc87