Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: flaky test due to second-resolution for thread ordering (#12692)

jif-oaia046849438c6
diff --git a/codex-rs/exec/tests/suite/resume.rs b/codex-rs/exec/tests/suite/resume.rs
index e5074da748..8cd8fffb40 100644
--- a/codex-rs/exec/tests/suite/resume.rs
+++ b/codex-rs/exec/tests/suite/resume.rs
@@ -278,6 +278,11 @@ fn exec_resume_last_respects_cwd_filter_and_all_flag() -> anyhow::Result<()> {
.assert()
.success();
+ // `resume --last` sorts by `updated_at`, which is second-granularity. Sleep so
+ // the upcoming `resume --last --all` write lands in a later second and becomes
+ // deterministically newest (instead of tying and falling back to UUID order).
+ std::thread::sleep(std::time::Duration::from_millis(1100));
+
let marker_b2 = format!("resume-cwd-b-2-{}", Uuid::new_v4());
let prompt_b2 = format!("echo {marker_b2}");
test.cmd()