Lightweight coding agent that runs in your terminal
Rust
fix: reduce flakiness of compact_resume_after_second_compaction_preserves_history (#11663)
Michael Bolin2383978a2c1f
diff --git a/codex-rs/core/tests/suite/compact_resume_fork.rs b/codex-rs/core/tests/suite/compact_resume_fork.rsindex ff90d4baf4..fc77a2621f 100644--- a/codex-rs/core/tests/suite/compact_resume_fork.rs+++ b/codex-rs/core/tests/suite/compact_resume_fork.rs@@ -932,9 +932,16 @@ async fn mount_second_compact_flow(server: &MockServer) -> Vec<ResponseMock> {]);let sse7 = sse(vec![ev_completed("r7")]);+ // Keep this matcher broad enough to survive prompt-shape differences across+ // platforms/config (history may include either marker text or compact prompt+ // fragments), but explicitly exclude the final resume turn so these two+ // one-shot mocks cannot race for the same request.let match_second_compact = |req: &wiremock::Request| {let body = std::str::from_utf8(&req.body).unwrap_or("");- body.contains("AFTER_FORK")+ (body.contains("AFTER_FORK")+ || body_contains_text(body, SUMMARIZATION_PROMPT)+ || body.contains(&json_fragment(FIRST_REPLY)))+ && !body.contains(&format!("\"text\":\"{AFTER_SECOND_RESUME}\""))};let second_compact = mount_sse_once_match(server, match_second_compact, sse6).await;@@ -984,7 +991,13 @@ async fn compact_conversation(conversation: &Arc<CodexThread>) {.submit(Op::Compact).await.expect("compact conversation");- let warning_event = wait_for_event(conversation, |ev| matches!(ev, EventMsg::Warning(_))).await;+ let warning_event = wait_for_event(conversation, |ev| {+ matches!(+ ev,+ EventMsg::Warning(WarningEvent { message }) if message == COMPACT_WARNING_MESSAGE+ )+ })+ .await;let EventMsg::Warning(WarningEvent { message }) = warning_event else {panic!("expected warning event after compact");};