mirror of
https://github.com/openai/codex.git
synced 2026-12-03 00:41:03 +00:00
## Why Restoring active context after compaction selects retained messages can move it across user turns. For example, instructions for a context-only heartbeat can end up before an earlier, already answered user question. ## What changed Retain active context in source order when building compacted history and resetting the context window. Use the full items from live history so active tool outputs and messages survive prompt shortening. ## Testing Add regression coverage for a heartbeat that compacts mid-turn, and verify ordering around repeated user message IDs and pending agent messages in local and remote compaction. GitOrigin-RevId: b670f3c4e87331a61986b4c163f892e43bd0261d