mirror of
https://github.com/openai/codex.git
synced 2026-11-13 06:45:07 +00:00
Derive sandbox contexts from turn environments (#40551)
## What changed - Add Windows sandbox mode, private-desktop behavior, and legacy Landlock selection to each `EnvironmentConfig`. - Centralize sandbox context construction on `TurnEnvironment`, preserving environment-owned permissions, paths, and backend settings while applying additional permission grants. - Use the environment-derived context for project instructions, capability discovery, file uploads, and filesystem-oriented tools. ## Testing - Verify capability discovery uses the selected environment's permission profile and sandbox backends when they differ from the thread defaults. GitOrigin-RevId: 7ae2fed90c8ada950f2e8431e571e9b2c793c291
This commit is contained in:
1 parent
348f49b292
commit
8444cf63b5
47 files changed
+341
-151
No files matched your search
@@ -716,6 +716,8 @@ impl Session {
|
||||
allow_login_shell: config.permissions.allow_login_shell,
|
||||
shell_environment_policy: config.permissions.shell_environment_policy.clone(),
|
||||
windows_sandbox_level: WindowsSandboxLevel::from_config(&config),
|
||||
windows_sandbox_private_desktop: config.permissions.windows_sandbox_private_desktop,
|
||||
use_legacy_landlock: config.features.use_legacy_landlock(),
|
||||
legacy_fallback_cwd: config.cwd.clone(),
|
||||
codex_home: config.codex_home.clone(),
|
||||
thread_name: None,
|
||||
@@ -3254,11 +3256,7 @@ impl Session {
|
||||
let environments = turn_context.environments.refresh_readiness();
|
||||
self.services
|
||||
.agents_md_manager
|
||||
.refresh(
|
||||
&turn_context.config,
|
||||
&environments,
|
||||
turn_context.windows_sandbox_level,
|
||||
)
|
||||
.refresh(&turn_context.config, &environments)
|
||||
.await?;
|
||||
let loaded_agents_md = self.services.agents_md_manager.get_loaded().await;
|
||||
let selected_capability_roots = self
|
||||
@@ -3271,7 +3269,6 @@ impl Session {
|
||||
&turn_context.config,
|
||||
&ready_selected_capability_roots,
|
||||
&environments,
|
||||
turn_context.windows_sandbox_level,
|
||||
)
|
||||
.or_cancel(cancellation_token)
|
||||
.await?;
|
||||
@@ -3292,10 +3289,7 @@ impl Session {
|
||||
.map(|environment| {
|
||||
(
|
||||
environment.selection.environment_id.clone(),
|
||||
turn_context.file_system_sandbox_context(
|
||||
/*additional_permissions*/ None,
|
||||
environment,
|
||||
),
|
||||
environment.sandbox_context(/*additional_permissions*/ None),
|
||||
)
|
||||
})
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
Reference in new issue
Block a user