test: materialize compact rollout references

This commit is contained in:
Friel
2026-05-04 09:29:46 +00:00
parent f2a6d197a6
commit 2958788aa4

View File

@@ -2,6 +2,7 @@
use codex_core::compact::SUMMARIZATION_PROMPT;
use codex_core::compact::SUMMARY_PREFIX;
use codex_core::config::Config;
use codex_core::materialize_rollout_items_for_replay;
use codex_features::Feature;
use codex_login::CodexAuth;
use codex_model_provider_info::ModelProviderInfo;
@@ -260,7 +261,6 @@ async fn summarize_context_three_requests_and_instructions() {
});
let test = builder.build(&server).await.unwrap();
let codex = test.codex.clone();
let rollout_path = test.session_configured.rollout_path.expect("rollout path");
// 1) Normal user input should hit server once.
codex
@@ -393,6 +393,7 @@ async fn summarize_context_three_requests_and_instructions() {
);
// Shut down Codex to flush rollout entries before inspecting the file.
let rollout_path = codex.current_rollout_path().await.expect("rollout path");
codex.submit(Op::Shutdown).await.unwrap();
wait_for_event(&codex, |ev| matches!(ev, EventMsg::ShutdownComplete)).await;
@@ -404,8 +405,7 @@ async fn summarize_context_three_requests_and_instructions() {
rollout_path.display()
)
});
let mut regular_turn_context_count = 0usize;
let mut saw_compacted_summary = false;
let mut rollout_items = Vec::new();
for line in text.lines() {
let trimmed = line.trim();
if trimmed.is_empty() {
@@ -414,7 +414,15 @@ async fn summarize_context_three_requests_and_instructions() {
let Ok(entry): Result<RolloutLine, _> = serde_json::from_str(trimmed) else {
continue;
};
match entry.item {
rollout_items.push(entry.item);
}
let rollout_items =
materialize_rollout_items_for_replay(test.config.codex_home.as_path(), &rollout_items)
.await;
let mut regular_turn_context_count = 0usize;
let mut saw_compacted_summary = false;
for item in rollout_items {
match item {
RolloutItem::TurnContext(_) => {
regular_turn_context_count += 1;
}