mirror of
https://github.com/openai/codex.git
synced 2026-11-24 15:21:20 +00:00
Harden internal Guardian session isolation (#40497)
## Why Internal Guardian reviews must remain independent of parent-session customization while still honoring managed execution and environment restrictions. ## What changed - Apply the restricted Guardian session path to both internal and subagent review sources. - Start internal reviews without inherited user instructions, extensions, MCP servers, or multi-agent behavior. - Preserve managed execution policy and selected environment constraints while exposing only the allowed review tools. Honor shell feature restrictions across every selected environment and retain code mode when enabled. ## Testing - Cover internal review isolation from parent state and managed instructions. - Cover optional tool filtering, managed shell restrictions, code mode, and secondary environment profiles. GitOrigin-RevId: edbf7d8a6fe3ee8213a1c75bc8ec331a1cf49006
This commit is contained in:
1 parent
be3a666143
commit
8476434a97
11 files changed
+475
-62
No files matched your search
@@ -1882,21 +1882,44 @@ impl ThreadManagerState {
|
||||
threads.remove(&resumed.conversation_id);
|
||||
}
|
||||
}
|
||||
let user_instructions = self
|
||||
.user_instructions_for_spawn(&session_source, parent_thread_id, forked_from_thread_id)
|
||||
.await;
|
||||
let (
|
||||
user_instructions,
|
||||
inherited_exec_policy,
|
||||
extensions,
|
||||
mcp_manager,
|
||||
multi_agent_version,
|
||||
) = if crate::guardian::is_basic_session_source(&session_source) {
|
||||
(
|
||||
LoadedUserInstructions::default(),
|
||||
None,
|
||||
empty_extension_registry(),
|
||||
Arc::new(McpManager::new(Arc::clone(&self.plugins_manager))),
|
||||
Some(MultiAgentVersion::Disabled),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
self.user_instructions_for_spawn(
|
||||
&session_source,
|
||||
parent_thread_id,
|
||||
forked_from_thread_id,
|
||||
)
|
||||
.await,
|
||||
inherited_exec_policy,
|
||||
Arc::clone(&self.extensions),
|
||||
Arc::clone(&self.mcp_manager),
|
||||
self.initial_multi_agent_version_for_spawn(
|
||||
&initial_history,
|
||||
Some(&session_source),
|
||||
parent_thread_id,
|
||||
forked_from_thread_id,
|
||||
)
|
||||
.await,
|
||||
)
|
||||
};
|
||||
let parent_rollout_thread_trace = self
|
||||
.parent_rollout_thread_trace_for_source(&session_source, &initial_history)
|
||||
.await;
|
||||
let tracked_session_source = session_source.clone();
|
||||
let multi_agent_version = self
|
||||
.initial_multi_agent_version_for_spawn(
|
||||
&initial_history,
|
||||
Some(&session_source),
|
||||
parent_thread_id,
|
||||
forked_from_thread_id,
|
||||
)
|
||||
.await;
|
||||
let originator = self
|
||||
.effective_originator(
|
||||
&initial_history,
|
||||
@@ -1925,9 +1948,9 @@ impl ThreadManagerState {
|
||||
environment_manager: Arc::clone(&self.environment_manager),
|
||||
skills_service: Arc::clone(&self.skills_service),
|
||||
plugins_manager: Arc::clone(&self.plugins_manager),
|
||||
mcp_manager: Arc::clone(&self.mcp_manager),
|
||||
mcp_manager,
|
||||
code_mode_session_provider: Arc::clone(&self.code_mode_session_provider),
|
||||
extensions: Arc::clone(&self.extensions),
|
||||
extensions,
|
||||
conversation_history: initial_history,
|
||||
requested_history_mode: history_mode,
|
||||
fork_persistence,
|
||||
|
||||
Reference in new issue
Block a user