mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Honor per-environment shell variable policies (#38902)
## What changed - Carry `ShellEnvironmentPolicy` in each resolved `EnvironmentConfig` and use the selected turn environment's policy for shell commands, user shell tasks, and unified exec. - Infer the policy from the thread configuration when an environment does not provide its own resolved configuration. - Redact the policy from `EnvironmentConfig` debug output because it can contain explicit environment variable values. ## Testing - Verify shell handlers and unified exec filter inherited variables according to the selected environment while preserving its explicit overrides. GitOrigin-RevId: 9f6a52aa4af60e5f17251a0e1b11e1926b779055
This commit is contained in:
1 parent
f85e81d30b
commit
6c108912ee
22 files changed
+219
-52
No files matched your search
@@ -695,6 +695,8 @@ impl Session {
|
||||
approval_policy: config.permissions.approval_policy.clone(),
|
||||
approvals_reviewer: config.approvals_reviewer,
|
||||
permission_profile_state: session_permission_profile_state_from_config(&config)?,
|
||||
allow_login_shell: config.permissions.allow_login_shell,
|
||||
shell_environment_policy: config.permissions.shell_environment_policy.clone(),
|
||||
windows_sandbox_level: WindowsSandboxLevel::from_config(&config),
|
||||
legacy_fallback_cwd: config.cwd.clone(),
|
||||
codex_home: config.codex_home.clone(),
|
||||
@@ -1596,12 +1598,14 @@ impl Session {
|
||||
if mcp_inputs_changed {
|
||||
self.mark_mcp_runtime_dirty();
|
||||
}
|
||||
let environment_config = updated.turn_environment_config();
|
||||
let environment_config = updated.inferred_environment_config();
|
||||
if let Some(environments) = &updates.environments {
|
||||
self.services
|
||||
.turn_environments
|
||||
.update_selections(&environments.environments, &environment_config);
|
||||
} else if state.session_configuration.turn_environment_config() != environment_config {
|
||||
} else if state.session_configuration.inferred_environment_config()
|
||||
!= environment_config
|
||||
{
|
||||
self.services
|
||||
.turn_environments
|
||||
.update_thread_config(&environment_config);
|
||||
|
||||
Reference in new issue
Block a user