feat(cli): add explicit sandbox permission profiles#20117
Conversation
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
7b4615b to
8fcc1c3
Compare
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/cli/src/debug_sandbox.rs
Lines 628 to 634 in 8fcc1c3
--permissions-profile over profile sandbox_mode
load_debug_sandbox_config_with_codex_home returns early whenever default_permissions exists, but config compilation can still resolve to legacy mode when an active config profile sets sandbox_mode (via core's syntax resolution). In that case the new --permissions-profile flag is accepted yet ignored, and the command may run under the profile's legacy sandbox level instead of the requested permissions profile.
ℹ️ 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".
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Why
codex sandboxis useful for exercising sandbox behavior directly, but before this stack the CLIonly picked up permission profiles indirectly from the active config. The existing debug-sandbox path
already compiled
[permissions]profiles through normal config loading, as covered by the existingprofile tests in
debug_sandbox.rs.This adds the smallest stable entry point first: an explicit profile selector that reuses the same
config machinery as normal Codex config, so standalone testing becomes possible without changing
current no-selector behavior.
What changed
--permissions-profile NAMEsupport tocodex sandbox macos|linux|windows.default_permissionsthrough theexisting config compilation path instead of inventing a sandbox-only parser.
sandbox_mode.Stack
sandbox-ui-profile--> this PRsandbox-ui-configBoth PRs are additive. Replay JSON is intentionally deferred to a follow-up design pass.
Tests ran
cargo test -p codex-cli debug_sandboxcargo test -p codex-cli sandbox_macos_parses_permissions_profilecargo test -p codex-core cli_override_takes_precedence_over_profile_sandbox_mode:workspaceand user-definedprofiles both executed successfully through
--permissions-profile.:workspaceanduser-defined profiles both executed successfully through
--permissions-profile.