diff --git a/codex-rs/memories/write/src/startup_tests.rs b/codex-rs/memories/write/src/startup_tests.rs index 009b8a6dbe..f80624ac62 100644 --- a/codex-rs/memories/write/src/startup_tests.rs +++ b/codex-rs/memories/write/src/startup_tests.rs @@ -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::(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 {