Skip to content

feat(cli): add sandbox profile config controls#20118

Merged
viyatb-oai merged 2 commits intomainfrom
codex/viyatb/sandbox-ui-config
Apr 29, 2026
Merged

feat(cli): add sandbox profile config controls#20118
viyatb-oai merged 2 commits intomainfrom
codex/viyatb/sandbox-ui-config

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

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

Why

The explicit profile path from #20117 is meant for standalone testing, but it still inherited the
shell cwd and all managed requirements implicitly. The pre-existing launcher path even called out
that it did not support a separate cwd yet in
debug_sandbox.rs.

For a standalone command, the useful default is to let the caller choose the project directory being
tested and to avoid administrator-provided constraints unless the caller explicitly wants to test
those too.

What changed

  • Add explicit-profile-only -C/--cd DIR, and use that cwd for both profile resolution and command
    execution.
  • Add explicit-profile-only --include-managed-config.
  • Make explicit profile mode skip managed requirement sources by default, including cloud
    requirements, MDM requirements, /etc/codex/requirements.toml, and the legacy managed-config
    requirements projection.
  • Preserve all existing invocations outside the explicit-profile path.

Stack

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

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_
  • cargo test -p codex-core load_config_layers_can_ignore_managed_requirements
  • cargo test -p codex-core load_config_layers_includes_cloud_requirements
  • macOS branch-binary smoke on the rebased top of stack: -C changed execution cwd, explicit
    profile mode omitted managed proxy env under env -i, and --include-managed-config restored it.
  • Linux devbox branch-binary smoke on the rebased top of stack: -C changed execution cwd for
    built-in and user-defined explicit profiles.

Comment thread codex-rs/core/src/config/config_loader_tests.rs
Comment thread codex-rs/cli/src/main.rs Outdated
Comment thread codex-rs/cli/src/lib.rs
Comment thread codex-rs/cli/src/lib.rs
Comment thread codex-rs/cli/src/debug_sandbox.rs Outdated
viyatb-oai added a commit that referenced this pull request 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`](https://github.com/openai/codex/blob/de2ccf94735a3d8a2a7077e6a5292026413867cf/codex-rs/cli/src/debug_sandbox.rs#L715-L760).

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. #20117 `sandbox-ui-profile` --> this PR
2. #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`.
Base automatically changed from codex/viyatb/sandbox-ui-profile to main April 29, 2026 06:18
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-config branch from 3152d62 to 3ec0fbd Compare April 29, 2026 06:26
@viyatb-oai viyatb-oai enabled auto-merge (squash) April 29, 2026 06:34
@viyatb-oai viyatb-oai merged commit 5597925 into main Apr 29, 2026
25 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/sandbox-ui-config branch April 29, 2026 06:55
@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