Separate MCP sandbox policy from launcher metadata (#53709)

## Why

MCP servers must forward sandbox policy unchanged to `codex sandbox --sandbox-state-json`, while interpreting launcher information to find the Codex CLI. Keep those contracts separate so consumers can preserve unknown policy fields.

## What changed

- Accept the experimental `codex/sandbox-state` capability alongside the deprecated `codex/sandbox-state-meta` capability, and send identical policy values under both `_meta` keys.
- Move `codexExecutable` out of the policy into `codex/sandbox-launcher`, supplied only when a verified CLI path is available for a local stdio server.
- Replace stale sandbox metadata while retaining unrelated entries, and remove stale launcher metadata when no launcher is available.
- Document the metadata contract and how servers should forward policy and retain authority for long-lived subprocesses.

## Testing

Update unit and integration coverage for policy serialization, identical state aliases, launcher availability across execution environments, and stale metadata replacement.

GitOrigin-RevId: e544c06e6e023953b1fc8069b7b1affa065262d1
This commit is contained in:
Michael Bolin
2026-10-13 16:23:44 +00:00
committed by copyberry
parent cb7091b180
commit 7d0b91d5d6
13 changed files with 291 additions and 169 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ pub use login::run_logout;
#[derive(Debug, Default, Args)]
pub struct SandboxStateArgs {
/// JSON value from `codex/sandbox-state-meta` to apply directly.
/// Opaque JSON value from `codex/sandbox-state` to apply directly.
#[arg(
long = "sandbox-state-json",
value_name = "JSON",