Send sandbox state through MCP tool metadata#17763
Conversation
bolinfest
left a comment
There was a problem hiding this comment.
It would be good to have an integration test for this.
| } | ||
| } | ||
|
|
||
| pub const MCP_SANDBOX_STATE_CAPABILITY: &str = "codex/sandbox-state"; |
There was a problem hiding this comment.
I should get rid of this, but I'll do that in a follow-up PR.
| /// Custom MCP request to push sandbox state updates. | ||
| /// When used, the `params` field of the notification is [`SandboxState`]. | ||
| pub const MCP_SANDBOX_STATE_METHOD: &str = "codex/sandbox-state/update"; | ||
| pub const MCP_SANDBOX_STATE_META_CAPABILITY: &str = "codex/sandbox-state-meta"; |
There was a problem hiding this comment.
Can you add a docstring to explain what this capability does?
| @@ -646,6 +647,7 @@ | |||
| /// Custom MCP request to push sandbox state updates. | |||
| /// When used, the `params` field of the notification is [`SandboxState`]. | |||
| pub const MCP_SANDBOX_STATE_METHOD: &str = "codex/sandbox-state/update"; | |||
There was a problem hiding this comment.
I should be able to remove this, as well.
| return Ok(meta); | ||
| } | ||
|
|
||
| let sandbox_state = serde_json::to_value(SandboxState { |
There was a problem hiding this comment.
SandboxState was introduced before we introduced PermissionProfile:
codex/codex-rs/protocol/src/models.rs
Lines 106 to 110 in d7f9d5c
I think we should be passing that instead (and update codex sandbox to take it).
Also, I don't think you need codex_linux_sandbox_exe, though you likely want the path to codex itself?
There was a problem hiding this comment.
one thing I'm concerned about is that it looks like FileSystemSandboxPolicy/NetworkSandboxPolicy are more expressive than PermissionProfile. for example, FileSystemSandboxPolicy can give readwrite access to /some/folder except readonly access to /some/folder/readonly/, which I don't think we can express with PermissionProfile.
There was a problem hiding this comment.
Sorry, yes, I'll fix this up once I merge #15914
Changes
Allows MCPs to opt in to receiving sandbox config info through
_metaon model-initiated tool calls. This lets MCPs adhere to the thread's sandbox if they choose to.Details
codex/sandbox-state-metaexperimental MCP capability.codex-coreinjects the currentSandboxStateinto model-initiated MCP tool-call request_meta.Verification