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
This commit is contained in:
jif
2026-07-30 11:41:47 +00:00
committed by copyberry
parent bdda5da56c
commit aa06446345
@@ -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(())
}