From 0d58012ec20d0f42ea1c11056815e4a0c5122e99 Mon Sep 17 00:00:00 2001 From: jif Date: Wed, 14 Oct 2026 11:59:55 +0000 Subject: [PATCH] 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 --- codex-rs/memories/write/src/startup_tests.rs | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 {