mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Resolve Guardian command path conventions inside ReviewAction (#57507)
## What changed Move executor path-convention selection from the approval caller into `ReviewAction::from_approval_action`, using the supplied `GuardianReviewContext`. Preserve Windows and POSIX rendering based on the executor OS, with path inference for legacy executors that do not report an OS. ## Testing Update the command approval test to exercise `ReviewAction` with Windows, Linux, and legacy executor contexts, checking both approval JSON and assessment working directories. GitOrigin-RevId: b13fad1d4033976cb94b899b62a3779c97e171fa
This commit is contained in:
@@ -623,34 +623,7 @@ impl Session {
|
||||
}
|
||||
let is_network_approval = matches!(&action, ApprovalAction::NetworkAccess { .. });
|
||||
let review_id = new_guardian_review_id();
|
||||
let exec_command_cwd_convention = match &action {
|
||||
ApprovalAction::ExecCommand {
|
||||
environment_id,
|
||||
cwd,
|
||||
..
|
||||
} => Some(
|
||||
match ctx
|
||||
.review_context
|
||||
.environments()
|
||||
.turn_environments()
|
||||
.find(|environment| environment.selection.environment_id == *environment_id)
|
||||
.and_then(|environment| environment.executor_platform_os.as_deref())
|
||||
{
|
||||
Some("windows") => PathConvention::Windows,
|
||||
Some(_) => PathConvention::Posix,
|
||||
// Legacy executors did not report their OS. Preserve the
|
||||
// previous spelling-based behavior for those executors.
|
||||
None => cwd
|
||||
.infer_path_convention()
|
||||
.unwrap_or_else(PathConvention::native),
|
||||
},
|
||||
),
|
||||
_ => None,
|
||||
};
|
||||
let action = crate::guardian::ReviewAction::from_approval_action(
|
||||
action,
|
||||
exec_command_cwd_convention,
|
||||
);
|
||||
let action = crate::guardian::ReviewAction::from_approval_action(action, &context);
|
||||
|
||||
let reasons = ApprovalRequestReasons {
|
||||
approval: ctx.approval_reason.clone(),
|
||||
|
||||
Reference in New Issue
Block a user