mirror of
https://github.com/openai/codex.git
synced 2026-09-08 15:50:34 +00:00
mcp: send sandbox metadata as permission profile only
This commit is contained in:
@@ -11,7 +11,6 @@ use std::time::Duration;
|
||||
|
||||
use codex_exec_server::Environment;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
@@ -21,7 +20,6 @@ use serde::Serialize;
|
||||
pub struct SandboxState {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub permission_profile: Option<PermissionProfile>,
|
||||
pub sandbox_policy: SandboxPolicy,
|
||||
pub codex_linux_sandbox_exe: Option<PathBuf>,
|
||||
pub sandbox_cwd: PathBuf,
|
||||
#[serde(default)]
|
||||
|
||||
@@ -578,7 +578,6 @@ async fn augment_mcp_tool_request_meta_with_sandbox_state(
|
||||
|
||||
let sandbox_state = serde_json::to_value(SandboxState {
|
||||
permission_profile: Some(turn_context.permission_profile()),
|
||||
sandbox_policy: turn_context.sandbox_policy(),
|
||||
codex_linux_sandbox_exe: turn_context.codex_linux_sandbox_exe.clone(),
|
||||
sandbox_cwd: turn_context.cwd.to_path_buf(),
|
||||
use_legacy_landlock: turn_context.features.use_legacy_landlock(),
|
||||
|
||||
@@ -821,13 +821,11 @@ async fn stdio_mcp_tool_call_includes_sandbox_state_meta() -> anyhow::Result<()>
|
||||
let sandbox_meta = meta
|
||||
.get(MCP_SANDBOX_STATE_META_CAPABILITY)
|
||||
.expect("sandbox state metadata should be present");
|
||||
let (sandbox_policy, _) =
|
||||
turn_permission_fields(PermissionProfile::read_only(), fixture.config.cwd.as_path());
|
||||
let expected_sandbox_policy = serde_json::to_value(&sandbox_policy)?;
|
||||
assert_eq!(
|
||||
sandbox_meta.get("sandboxPolicy"),
|
||||
Some(&expected_sandbox_policy)
|
||||
sandbox_meta.get("permissionProfile"),
|
||||
Some(&serde_json::to_value(PermissionProfile::read_only())?)
|
||||
);
|
||||
assert_eq!(sandbox_meta.get("sandboxPolicy"), None);
|
||||
assert_eq!(
|
||||
sandbox_meta.get("sandboxCwd").and_then(Value::as_str),
|
||||
fixture.config.cwd.as_path().to_str()
|
||||
|
||||
Reference in New Issue
Block a user