From 926b8d77cd2a2a0a764804260c460dd7364df49c Mon Sep 17 00:00:00 2001 From: starr-openai Date: Thu, 7 May 2026 04:30:05 -0700 Subject: [PATCH] Tolerate transient Windows metadata denial in memory startup test Keep polling when Windows temporarily denies metadata reads while the phase 2 memory workspace is being cleaned up, so the test still verifies the file is removed and the baseline becomes clean. Co-authored-by: Codex --- codex-rs/memories/write/src/startup_tests.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/codex-rs/memories/write/src/startup_tests.rs b/codex-rs/memories/write/src/startup_tests.rs index 4fcb1d409b..a8b35d7c19 100644 --- a/codex-rs/memories/write/src/startup_tests.rs +++ b/codex-rs/memories/write/src/startup_tests.rs @@ -372,7 +372,16 @@ async fn wait_for_single_request(mock: &ResponseMock) -> ResponsesRequest { async fn wait_for_file_removed(path: &Path) -> anyhow::Result<()> { let deadline = Instant::now() + Duration::from_secs(10); loop { - if !tokio::fs::try_exists(path).await? { + let exists = match tokio::fs::try_exists(path).await { + Ok(exists) => exists, + Err(err) if err.kind() == std::io::ErrorKind::PermissionDenied => { + // Windows can transiently deny metadata reads while another task + // is removing or resetting files in this workspace. + true + } + Err(err) => return Err(err.into()), + }; + if !exists { return Ok(()); } assert!(