Skip to content

feat(cli): add explicit sandbox permission profiles#20117

Merged
viyatb-oai merged 4 commits intomainfrom
codex/viyatb/sandbox-ui-profile
Apr 29, 2026
Merged

feat(cli): add explicit sandbox permission profiles#20117
viyatb-oai merged 4 commits intomainfrom
codex/viyatb/sandbox-ui-profile

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 29, 2026

Why

codex sandbox is useful for exercising sandbox behavior directly, but before this stack the CLI
only 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 existing
profile 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

  • Add additive --permissions-profile NAME support to codex sandbox macos|linux|windows.
  • Resolve built-in and user-defined profile names by feeding default_permissions through the
    existing config compilation path instead of inventing a sandbox-only parser.
  • Make an explicit selector win over an ambient active profile's legacy sandbox_mode.
  • Keep the existing no-selector behavior unchanged.

Stack

  1. feat(cli): add explicit sandbox permission profiles #20117 sandbox-ui-profile --> this PR
  2. feat(cli): add sandbox profile config controls #20118 sandbox-ui-config

Both PRs are additive. Replay JSON is intentionally deferred to a follow-up design pass.

Tests ran

  • cargo test -p codex-cli debug_sandbox
  • cargo test -p codex-cli sandbox_macos_parses_permissions_profile
  • cargo test -p codex-core cli_override_takes_precedence_over_profile_sandbox_mode
  • macOS branch-binary smoke on the rebased top of stack: built-in :workspace and user-defined
    profiles both executed successfully through --permissions-profile.
  • Linux devbox branch-binary smoke on the rebased top of stack: built-in :workspace and
    user-defined profiles both executed successfully through --permissions-profile.

Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/sandbox-ui-profile branch from 7b4615b to 8fcc1c3 Compare April 29, 2026 02:50
@viyatb-oai viyatb-oai marked this pull request as ready for review April 29, 2026 04:07
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

💡 Codex Review

if config_uses_permission_profiles(&config) {
if full_auto {
anyhow::bail!(
"`codex sandbox --full-auto` is only supported for legacy `sandbox_mode` configs; choose a writable `[permissions]` profile instead"
);
}
return Ok(config);

P1 Badge Honor --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".

Comment thread codex-rs/cli/src/debug_sandbox.rs Outdated
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai requested a review from a team as a code owner April 29, 2026 05:38
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai enabled auto-merge (squash) April 29, 2026 06:04
@viyatb-oai viyatb-oai merged commit 6ed0440 into main Apr 29, 2026
25 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/sandbox-ui-profile branch April 29, 2026 06:18
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 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