Skip to content

feat(cli): /sandbox on|off|toggle for runtime state change#202

Merged
emal-avala merged 1 commit intomainfrom
feat/sandbox-toggle
Apr 23, 2026
Merged

feat(cli): /sandbox on|off|toggle for runtime state change#202
emal-avala merged 1 commit intomainfrom
feat/sandbox-toggle

Conversation

@emal-avala
Copy link
Copy Markdown
Member

@emal-avala emal-avala commented Apr 23, 2026

Summary

Extends the existing /sandbox command to accept a subcommand that flips config.sandbox.enabled at runtime — no restart needed. Alias /sandbox-toggle.

/sandbox               show status (unchanged)
/sandbox on            enable the sandbox
/sandbox off           disable the sandbox
/sandbox toggle        flip state

Why

Users run into a common workflow: start the REPL, hit repeated sandbox denials on a trusted workload, want to disable the sandbox for the remainder of the session. Previously required exiting and re-running with --no-sandbox. Now a single command.

Safety

  • security.disable_bypass_permissions gate respectedoff and toggle-from-enabled are blocked with a clear message when the config flag is set
  • Strategy-missing warning — enabling on a host with no working strategy (e.g. Linux without bwrap set up) prints a ⚠ note so the user knows tools will still run unsandboxed
  • Scope — change applies to new subprocess tool calls. In-flight bash calls keep whatever policy they were launched with

Zero-arg status-display path is unchanged (no-op subcommand).

Test plan

  • cargo fmt --all — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test -p agent-code --test smoke — 4/4 pass
  • Manual: /sandbox on → enabled; /sandbox off → disabled; /sandbox toggle flips; unknown subcommand prints usage

Extends the existing `/sandbox` command to accept a subcommand that
flips `config.sandbox.enabled` at runtime, no restart needed.

  /sandbox                show status (unchanged)
  /sandbox on             enable the sandbox
  /sandbox off            disable the sandbox
  /sandbox toggle         flip state

Alias `/sandbox-toggle` kept for name-parity with TS Claude Code.

Safety:
  * When `security.disable_bypass_permissions` is set, `off` and
    `toggle`-from-enabled are blocked with a clear message
  * Enabling on a host with no working strategy (e.g. Linux without
    bwrap set up) prints a ⚠ note so the user knows tools will
    still run unsandboxed
  * Status-display path (no args) unchanged

Change applies to *new* subprocess tool calls. In-flight bash calls
keep whatever policy they were launched with.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit b5723cc into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/sandbox-toggle branch April 23, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant