mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +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
@@ -4,7 +4,6 @@ use crate::config::Config;
|
||||
use crate::environment_selection::TurnEnvironmentSnapshot;
|
||||
use codex_extension_api::UserInstructions;
|
||||
use codex_protocol::config_types::TrustLevel;
|
||||
use codex_protocol::config_types::WindowsSandboxLevel;
|
||||
use codex_protocol::protocol::TurnEnvironmentSelection;
|
||||
use std::io;
|
||||
use std::sync::Arc;
|
||||
@@ -20,7 +19,6 @@ pub(crate) struct AgentsMdManager {
|
||||
struct AgentsMdCache {
|
||||
selections: Option<Vec<TurnEnvironmentSelection>>,
|
||||
active_project_trust_level: Option<TrustLevel>,
|
||||
windows_sandbox_level: Option<WindowsSandboxLevel>,
|
||||
loaded: Option<Arc<LoadedAgentsMd>>,
|
||||
}
|
||||
|
||||
@@ -38,7 +36,6 @@ impl AgentsMdManager {
|
||||
&self,
|
||||
config: &Config,
|
||||
environments: &TurnEnvironmentSnapshot,
|
||||
windows_sandbox_level: WindowsSandboxLevel,
|
||||
) -> io::Result<()> {
|
||||
let selections = environments
|
||||
.turn_environments()
|
||||
@@ -49,28 +46,21 @@ impl AgentsMdManager {
|
||||
let mut cache = self.cache.lock().await;
|
||||
if cache.selections.as_ref() == Some(&selections)
|
||||
&& cache.active_project_trust_level == active_project_trust_level
|
||||
&& cache.windows_sandbox_level == Some(windows_sandbox_level)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
cache.selections = None;
|
||||
cache.active_project_trust_level = None;
|
||||
cache.windows_sandbox_level = None;
|
||||
cache.loaded = None;
|
||||
}
|
||||
|
||||
let loaded = load_project_instructions(
|
||||
config,
|
||||
self.user_instructions.clone(),
|
||||
environments,
|
||||
windows_sandbox_level,
|
||||
)
|
||||
.await?
|
||||
.map(Arc::new);
|
||||
let loaded =
|
||||
load_project_instructions(config, self.user_instructions.clone(), environments)
|
||||
.await?
|
||||
.map(Arc::new);
|
||||
let mut cache = self.cache.lock().await;
|
||||
cache.selections = Some(selections);
|
||||
cache.active_project_trust_level = active_project_trust_level;
|
||||
cache.windows_sandbox_level = Some(windows_sandbox_level);
|
||||
cache.loaded = loaded;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user