mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Persist resume metadata in compaction checkpoints (#47323)
## Why Compaction companion records do not represent all resume state, including the last started turn and previous turn settings. The selected multi-agent runtime also needs a persisted value when no companion turn context is present. ## What changed - Add optional `resume_metadata` to `CompactedItem`, recording the multi-agent version, last started turn ID, and previous turn settings. Preserve the distinction between absent metadata and explicitly empty values while retaining compatibility with older records. - Capture this metadata under the settings persistence lock alongside the compaction checkpoint. - Rewrite inherited metadata to use the child agent's runtime, and clear previous turn settings when the child must rebuild context. - Clear pending continuation state before delivering acceptance of standalone settings updates, while holding the persistence lock. ## Testing Add coverage for metadata round trips with empty values, legacy reader compatibility, checkpoint companion records, inherited fork metadata, and continuation invalidation while settings event delivery is blocked. GitOrigin-RevId: f30b7feaa7e2fdb5b65fc3c53b37fd7a7fe27903
This commit is contained in:
@@ -85,6 +85,7 @@ fn legacy_transcript_preview_scans_tail_across_compaction() {
|
||||
window_id: None,
|
||||
compaction_response_id: None,
|
||||
latest_token_usage_record: None,
|
||||
resume_metadata: None,
|
||||
}),
|
||||
rollout_user_message("recent user"),
|
||||
rollout_agent_message("commentary one\ncommentary two"),
|
||||
@@ -220,6 +221,7 @@ fn legacy_transcript_preview_falls_back_for_oversized_hidden_record() {
|
||||
window_id: None,
|
||||
compaction_response_id: None,
|
||||
latest_token_usage_record: None,
|
||||
resume_metadata: None,
|
||||
}),
|
||||
rollout_agent_message("recent assistant"),
|
||||
],
|
||||
@@ -251,6 +253,7 @@ fn legacy_transcript_preview_falls_back_when_scan_budget_is_exhausted() {
|
||||
window_id: None,
|
||||
compaction_response_id: None,
|
||||
latest_token_usage_record: None,
|
||||
resume_metadata: None,
|
||||
});
|
||||
let mut items = vec![rollout_user_message("older user")];
|
||||
items.extend(std::iter::repeat_n(compacted, 9));
|
||||
|
||||
Reference in New Issue
Block a user