Skip to content

Scope MCP sandbox metadata to server environment#28914

Merged
jif-oai merged 2 commits into
mainfrom
jif/mcp-sandbox-state-env
Jun 18, 2026
Merged

Scope MCP sandbox metadata to server environment#28914
jif-oai merged 2 commits into
mainfrom
jif/mcp-sandbox-state-env

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Scope MCP sandbox metadata to the MCP server's owning environment.

Previously, codex/sandbox-state-meta always used the turn's primary cwd and rebuilt a legacy sandbox policy from that cwd. That can be wrong for MCP servers owned by a different execution environment.

This now sends the owning environment cwd as a file: URI in sandboxCwd, keeps permissionProfile as the permission source of truth, and omits sandbox-state metadata when a non-default server environment is not selected for the turn. Local/default MCP servers keep the existing fallback cwd behavior.

Tests:

  • just fmt
  • just bazel-lock-update
  • just bazel-lock-check
  • just test -p codex-mcp
  • just test -p codex-core mcp_sandbox_cwd
  • cargo build -p codex-rmcp-client --bin test_stdio_server
  • just test -p codex-core stdio_mcp_tool_call_includes_sandbox_state_meta

@jif-oai jif-oai requested a review from a team as a code owner June 18, 2026 12:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d76490729

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/mcp_tool_call.rs Outdated
Comment thread codex-rs/core/src/mcp_tool_call.rs Outdated
Comment thread codex-rs/core/src/mcp_tool_call.rs Outdated
@jif-oai jif-oai force-pushed the jif/mcp-sandbox-state-env branch from 2d76490 to 58117ef Compare June 18, 2026 13:20
@jif-oai jif-oai merged commit 790213d into main Jun 18, 2026
41 of 47 checks passed
@jif-oai jif-oai deleted the jif/mcp-sandbox-state-env branch June 18, 2026 17:31
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants