Preserve executor paths in Guardian approval reviews (#42838)

## Why

Guardian approval actions can contain paths from a remote executor whose path convention differs from the host, such as Windows paths reviewed on a POSIX host. Converting those paths to host-native absolute paths prevents the action from being reviewed.

## What changed

- Render command working directories using the executor's reported path convention, and preserve URI-backed paths for attribution.
- Carry foreign command and patch paths through Guardian events and app-server schemas as legacy path strings.
- Bound remote plugin attribution within the overall review deadline and reject Guardian action payloads that exceed the review byte limit.

## Testing

- Cover Windows and POSIX executor path rendering, foreign patch paths, protocol round trips, oversized payload rejection, and remote Guardian review context.

GitOrigin-RevId: 38be0fcdac897139519e74e077eb5cb4f8f8017e
This commit is contained in:
iceweasel-oai authored and copyberry committed 2026-09-04 19:56:31 +00:00
1 parent 83b62a02fa
commit 773f0b081d
27 files changed
+442 -203

No files matched your search

@@ -76,25 +76,6 @@ fn approval_resolution_uses_acting_model_timeout_instructions() {
}
}
#[test]
fn guardian_cwd_preserves_drive_shaped_local_posix_path() {
let native_cwd = AbsolutePathBuf::try_from(std::path::PathBuf::from("/C:/workspace"))
.expect("drive-shaped POSIX path should be absolute");
let cwd = PathUri::from_abs_path(&native_cwd);
assert_eq!(
guardian_cwd(codex_exec_server::LOCAL_ENVIRONMENT_ID, cwd)
.expect("local cwd should retain the host path convention"),
native_cwd
);
}
#[test]
fn guardian_cwd_rejects_foreign_remote_path() {
let cwd = PathUri::parse("file:///C:/workspace").expect("valid Windows path URI");
assert!(guardian_cwd(codex_exec_server::REMOTE_ENVIRONMENT_ID, cwd).is_err());
}
#[tokio::test]
async fn explicit_mcp_reviewer_override_takes_precedence_over_action_context() {
let (session, turn, events) = make_session_and_context_with_rx().await;