From bbfc3f0152cf332d01547ddfac835409bc8ce485 Mon Sep 17 00:00:00 2001 From: "Adam Perry @ OpenAI" Date: Wed, 22 Jul 2026 20:45:37 +0000 Subject: [PATCH] Normalize Guardian review cwd reuse keys (#34824) ## What changed - Store the spawned session's working directory as a `PathUri` in `GuardianReviewSessionReuseKey` so reuse comparisons use its canonical URI representation. - Assert that the reuse key contains the converted working directory. GitOrigin-RevId: 68d440a37ebb310c610dabbb3373ed0ceff88dfa --- codex-rs/core/src/guardian/review_session.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/codex-rs/core/src/guardian/review_session.rs b/codex-rs/core/src/guardian/review_session.rs index dfc5457143a1..61955ac0848c 100644 --- a/codex-rs/core/src/guardian/review_session.rs +++ b/codex-rs/core/src/guardian/review_session.rs @@ -50,7 +50,7 @@ use crate::session::turn_context::TurnContext; use codex_config::types::McpServerConfig; use codex_features::Feature; use codex_model_provider_info::ModelProviderInfo; -use codex_utils_absolute_path::AbsolutePathBuf; +use codex_utils_path_uri::PathUri; use super::GUARDIAN_REVIEWER_NAME; use super::GuardianApprovalRequest; @@ -168,7 +168,7 @@ struct GuardianReviewSessionReuseKey { base_instructions: Option, user_instructions: Option, compact_prompt: Option, - cwd: AbsolutePathBuf, + cwd: PathUri, mcp_servers: Constrained>, codex_linux_sandbox_exe: Option, main_execve_wrapper_exe: Option, @@ -196,7 +196,7 @@ impl GuardianReviewSessionReuseKey { base_instructions: spawn_config.base_instructions.clone(), user_instructions, compact_prompt: spawn_config.compact_prompt.clone(), - cwd: spawn_config.cwd.clone(), + cwd: PathUri::from_abs_path(&spawn_config.cwd), mcp_servers: spawn_config.mcp_servers.clone(), codex_linux_sandbox_exe: spawn_config.codex_linux_sandbox_exe.clone(), main_execve_wrapper_exe: spawn_config.main_execve_wrapper_exe.clone(), @@ -1286,6 +1286,10 @@ mod tests { /*user_instructions*/ None, ); + assert_eq!( + cached_reuse_key.cwd, + PathUri::from_abs_path(&cached_spawn_config.cwd) + ); assert_ne!(cached_reuse_key, next_reuse_key); assert_eq!( cached_reuse_key,