From aa064463458adbef10400c74174107fc4b3550f0 Mon Sep 17 00:00:00 2001 From: jif Date: Thu, 30 Jul 2026 11:36:05 +0000 Subject: [PATCH] Isolate apply-patch permission test variants (#36138) ## What changed - Run the strict auto-review enabled and disabled scenarios as separate test cases on a two-thread Tokio runtime. - Explicitly shut down each Codex instance after verifying that the approved folder grant allows the later `apply_patch` call. GitOrigin-RevId: cbbf47d834c4a9adcf181b97b8aa72b5f0a513e2 --- .../core/tests/suite/request_permissions_tool.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/codex-rs/core/tests/suite/request_permissions_tool.rs b/codex-rs/core/tests/suite/request_permissions_tool.rs index e8434896ea..b02459c8cd 100644 --- a/codex-rs/core/tests/suite/request_permissions_tool.rs +++ b/codex-rs/core/tests/suite/request_permissions_tool.rs @@ -38,6 +38,7 @@ use serde_json::Value; use serde_json::json; use std::fs; use std::path::Path; +use test_case::test_case; fn absolute_path(path: &Path) -> AbsolutePathBuf { AbsolutePathBuf::try_from(path).expect("absolute path") @@ -328,16 +329,17 @@ async fn approved_folder_write_request_permissions_unblocks_later_exec_without_s Ok(()) } -#[tokio::test(flavor = "current_thread")] +#[test_case(false ; "without_strict_auto_review")] +#[test_case(true ; "with_strict_auto_review")] +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[cfg(target_os = "macos")] -async fn approved_folder_write_request_permissions_unblocks_later_apply_patch() -> Result<()> { +async fn approved_folder_write_request_permissions_unblocks_later_apply_patch( + strict_auto_review: bool, +) -> Result<()> { skip_if_no_network!(Ok(())); skip_if_sandbox!(Ok(())); - apply_patch_after_request_permissions(/*strict_auto_review*/ false).await?; - apply_patch_after_request_permissions(/*strict_auto_review*/ true).await?; - - Ok(()) + apply_patch_after_request_permissions(strict_auto_review).await } async fn apply_patch_after_request_permissions(strict_auto_review: bool) -> Result<()> { @@ -510,5 +512,7 @@ async fn apply_patch_after_request_permissions(strict_auto_review: bool) -> Resu format!("{patch_content}\n") ); + test.codex.shutdown_and_wait().await?; + Ok(()) }