Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Fixes intermittent test failures in CI (#6282)

Eric Trautd7953aed747e
diff --git a/codex-rs/app-server/tests/suite/archive_conversation.rs b/codex-rs/app-server/tests/suite/archive_conversation.rs
index 2d8f746a69..b6e85936fb 100644
--- a/codex-rs/app-server/tests/suite/archive_conversation.rs
+++ b/codex-rs/app-server/tests/suite/archive_conversation.rs
@@ -12,7 +12,7 @@ use std::path::Path;
use tempfile::TempDir;
use tokio::time::timeout;
-const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
+const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(20);
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn archive_conversation_moves_rollout_into_archived_directory() -> Result<()> {
diff --git a/codex-rs/core/tests/suite/compact.rs b/codex-rs/core/tests/suite/compact.rs
index b634cf0e2f..72fe21841b 100644
--- a/codex-rs/core/tests/suite/compact.rs
+++ b/codex-rs/core/tests/suite/compact.rs
@@ -108,19 +108,19 @@ async fn summarize_context_three_requests_and_instructions() {
let body = std::str::from_utf8(&req.body).unwrap_or("");
body.contains("\"text\":\"hello world\"") && !body.contains(COMPACT_PROMPT_MARKER)
};
- mount_sse_once_match(&server, first_matcher, sse1).await;
+ let first_request_mock = mount_sse_once_match(&server, first_matcher, sse1).await;
let second_matcher = |req: &wiremock::Request| {
let body = std::str::from_utf8(&req.body).unwrap_or("");
body.contains(COMPACT_PROMPT_MARKER)
};
- mount_sse_once_match(&server, second_matcher, sse2).await;
+ let second_request_mock = mount_sse_once_match(&server, second_matcher, sse2).await;
let third_matcher = |req: &wiremock::Request| {
let body = std::str::from_utf8(&req.body).unwrap_or("");
body.contains(&format!("\"text\":\"{THIRD_USER_MSG}\""))
};
- mount_sse_once_match(&server, third_matcher, sse3).await;
+ let third_request_mock = mount_sse_once_match(&server, third_matcher, sse3).await;
// Build config pointing to the mock server and spawn Codex.
let model_provider = ModelProviderInfo {
@@ -172,16 +172,13 @@ async fn summarize_context_three_requests_and_instructions() {
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TaskComplete(_))).await;
// Inspect the three captured requests.
- let requests = server.received_requests().await.unwrap();
- assert_eq!(requests.len(), 3, "expected exactly three requests");
-
- let req1 = &requests[0];
- let req2 = &requests[1];
- let req3 = &requests[2];
+ let req1 = first_request_mock.single_request();
+ let req2 = second_request_mock.single_request();
+ let req3 = third_request_mock.single_request();
- let body1 = req1.body_json::<serde_json::Value>().unwrap();
- let body2 = req2.body_json::<serde_json::Value>().unwrap();
- let body3 = req3.body_json::<serde_json::Value>().unwrap();
+ let body1 = req1.body_json();
+ let body2 = req2.body_json();
+ let body3 = req3.body_json();
// Manual compact should keep the baseline developer instructions.
let instr1 = body1.get("instructions").and_then(|v| v.as_str()).unwrap();