mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
[codex] Store compact window id in rollout (#27264)
## Why Compaction window identity is part of session history, not model-client transport state. Persisting it with the compacted rollout item lets resumed threads continue from the reconstructed window without keeping mutable window state on `ModelClient`. ## What changed - Added `window_id` to `CompactedItem` and stamp it when `replace_compacted_history` installs compacted history. - Moved auto-compact window id ownership into `AutoCompactWindow` / `SessionState`; `ModelClient` now receives the request window id from callers instead of storing it. - Returned `window_id` from rollout reconstruction for resume. Reconstruction uses the newest surviving compacted item's stored `window_id` when present, and falls back to the legacy compacted-item count when it is absent. - Kept fork startup at the fresh default window id and updated direct model-client tests to pass explicit test window ids. ## Validation - `cargo check -p codex-core --tests`
This commit is contained in:
1 parent
41b4fabbb4
commit
30ddb3325e
24 files changed
+192
-106
No files matched your search
@@ -65,18 +65,16 @@ async fn set_rate_limits_defaults_limit_id_to_codex_when_missing() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn replace_history_clears_auto_compact_window_prefill_without_advancing() {
|
||||
async fn replace_history_clears_auto_compact_window_prefill() {
|
||||
let session_configuration = make_session_configuration_for_tests().await;
|
||||
let mut state = SessionState::new(session_configuration);
|
||||
|
||||
state.start_next_auto_compact_window();
|
||||
state.set_auto_compact_window_estimated_prefill(/*tokens*/ 100);
|
||||
state.replace_history(Vec::new(), /*reference_context_item*/ None);
|
||||
|
||||
assert_eq!(
|
||||
state.auto_compact_window_snapshot(),
|
||||
AutoCompactWindowSnapshot {
|
||||
ordinal: 2,
|
||||
prefill_input_tokens: None,
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user