mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Keep step settings and approval environments consistent (#46556)
## Why Background processes can outlive their launching turn. Their approval reviews need the originating environment's filesystem restrictions, even when the active turn uses a different environment. Remote restrictions must also be resolved using executor paths rather than the local filesystem. ## What changed - Capture settings and environment selections together in `StepInputs`. Preserve the captured selection during active model updates while allowing environment startup to finish. - Carry environment IDs into Guardian network and `execve` requests, and use the owning process's environment with current review settings. Refresh environment readiness for network requests that fall back to the active turn. - Resolve remote denied paths and globs using the executor's policy context. Decline automatic approval when the request's environment is unavailable or an explicitly denied temporary directory cannot be resolved. ## Testing Add regression coverage for active model updates retaining their environment while the next turn adopts a new selection, background approvals using their owning environment, newly ready network environments, and remote denied paths and globs, including Windows paths and missing temporary-directory metadata. GitOrigin-RevId: b620d4b030c597a4f430fe0500864fa5469db3d4
This commit is contained in:
@@ -1955,10 +1955,16 @@ async fn resume_and_fork_do_not_restore_thread_environments_from_rollout() {
|
||||
.await
|
||||
.expect("build resumed turn context");
|
||||
let resumed_turn = prepared_turn;
|
||||
assert_eq!(resumed_turn.environments.turn_environments().count(), 1);
|
||||
assert_eq!(
|
||||
resumed_turn
|
||||
.environments
|
||||
.initial_environments
|
||||
.turn_environments()
|
||||
.count(),
|
||||
1
|
||||
);
|
||||
assert_eq!(
|
||||
resumed_turn
|
||||
.initial_environments
|
||||
.primary()
|
||||
.expect("primary environment")
|
||||
.cwd(),
|
||||
@@ -1966,7 +1972,7 @@ async fn resume_and_fork_do_not_restore_thread_environments_from_rollout() {
|
||||
);
|
||||
assert_ne!(
|
||||
resumed_turn
|
||||
.environments
|
||||
.initial_environments
|
||||
.primary()
|
||||
.expect("primary environment")
|
||||
.cwd(),
|
||||
@@ -1992,10 +1998,13 @@ async fn resume_and_fork_do_not_restore_thread_environments_from_rollout() {
|
||||
.await
|
||||
.expect("build forked turn context");
|
||||
let forked_turn = prepared_turn;
|
||||
assert_eq!(forked_turn.environments.turn_environments().count(), 1);
|
||||
assert_eq!(
|
||||
forked_turn.initial_environments.turn_environments().count(),
|
||||
1
|
||||
);
|
||||
assert_eq!(
|
||||
forked_turn
|
||||
.environments
|
||||
.initial_environments
|
||||
.primary()
|
||||
.expect("primary environment")
|
||||
.cwd(),
|
||||
@@ -2003,7 +2012,7 @@ async fn resume_and_fork_do_not_restore_thread_environments_from_rollout() {
|
||||
);
|
||||
assert_ne!(
|
||||
forked_turn
|
||||
.environments
|
||||
.initial_environments
|
||||
.primary()
|
||||
.expect("primary environment")
|
||||
.cwd(),
|
||||
|
||||
Reference in New Issue
Block a user