mirror of
https://github.com/openai/codex.git
synced 2026-09-20 12:47:38 +00:00
Replay guardian checkpoints into a fresh session in tests (#46514)
## Why Replaying a checkpoint into the original session can let preserved live state mask missing checkpoint data. ## What changed Update `guardian_checkpoint_preserves_live_context_without_storage` to restore forked history into a fresh session with the matching guardian context mode. Keep the existing context restoration assertions for both `Legacy` and `ThreadOwned` modes. GitOrigin-RevId: 211b567f6b33ffca6dc51110a208aec234004b98
This commit is contained in:
@@ -87,10 +87,14 @@ async fn guardian_checkpoint_preserves_live_context_without_storage(mode: Guardi
|
||||
session
|
||||
.replace_history(Vec::new(), /*reference_context_item*/ None)
|
||||
.await;
|
||||
session
|
||||
.record_initial_history(InitialHistory::Forked(items))
|
||||
// Replay into a fresh session so preserved live state cannot mask missing checkpoint data.
|
||||
let (mut fork, _) = make_session_and_context().await;
|
||||
fork.guardian_context_mode = mode;
|
||||
fork.state.lock().await.history =
|
||||
ContextManager::with_guardian_context_mode(mode, &SessionSource::default());
|
||||
fork.record_initial_history(InitialHistory::Forked(items))
|
||||
.await;
|
||||
let restored = session.clone_history().await;
|
||||
let restored = fork.clone_history().await;
|
||||
assert_eq!(restored.annotated_items(), expected.annotated_items());
|
||||
assert_eq!(restored.retained_context(), expected.retained_context());
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user