Test memory extraction budgets with excluded items and ciphertext (#53963)

Extend phase-one request tests for both memory versions with reasoning,
developer messages, and assistant ciphertext whose combined size exceeds
the reader budget while individual records remain below the record limit.
Verify that earlier extraction evidence and assistant text alongside large
ciphertext remain in the request, with `encrypted_content` excluded.

GitOrigin-RevId: f0e85e368e5a94d491d0aa4ae1688f47d873ccd9
This commit is contained in:
jif
2026-10-14 12:07:20 +00:00
committed by copyberry
parent 78dc250384
commit 0d58012ec2
@@ -897,6 +897,30 @@ async fn run_memory_phase_one_model_request_test(
contents.push_str(&serde_json::to_string(&line)?);
contents.push('\n');
}
// Each block exceeds the 8 MiB reader budget, while each record stays below 1 MiB.
// Excluded items and ciphertext must not displace the earlier extraction evidence.
for item in [
json!({"type":"reasoning", "summary":[],
"encrypted_content":"r".repeat(/*n*/ 512 * 1024)}),
json!({"type":"message", "role":"developer", "content":[
{"type":"input_text", "text":"d".repeat(/*n*/ 512 * 1024)},
]}),
json!({"type":"message", "role":"assistant", "phase":"final_answer",
"encrypted_content":"a".repeat(/*n*/ 512 * 1024), "content":[
{"type":"output_text", "text":"small assistant evidence behind ciphertext"},
]}),
] {
let line = RolloutLine {
timestamp: chrono::Utc::now().to_rfc3339(),
ordinal: None,
item: RolloutItem::ResponseItem(serde_json::from_value::<ResponseItem>(item)?.into()),
};
let line = serde_json::to_string(&line)?;
for _ in 0..16 {
contents.push_str(&line);
contents.push('\n');
}
}
// Exercise bounded reading through the actual extraction request, for both memory versions.
contents.push_str(&"x".repeat(1024 * 1024 + 1));
contents.push('\n');
@@ -949,6 +973,7 @@ async fn run_memory_phase_one_model_request_test(
let request = wait_for_single_request(&response).await;
let evidence = request.message_input_texts("user").join("");
assert!(evidence.contains("replay-bearing assistant evidence"));
assert!(evidence.contains("small assistant evidence behind ciphertext"));
assert!(evidence.contains("newest correction after an oversized record"));
assert!(!evidence.contains("encrypted_content"));
if version == codex_protocol::MemoryVersion::V1 {