Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

add `codex sandbox {linux|macos}` (#4782)

Fouad Matin77a8b7fdeb4f
diff --git a/codex-rs/README.md b/codex-rs/README.md
index 46eda63a1e..f5a5b838fc 100644
--- a/codex-rs/README.md
+++ b/codex-rs/README.md
@@ -71,9 +71,13 @@ To test to see what happens when a command is run under the sandbox provided by
```
# macOS
-codex debug seatbelt [--full-auto] [COMMAND]...
+codex sandbox macos [--full-auto] [COMMAND]...
# Linux
+codex sandbox linux [--full-auto] [COMMAND]...
+
+# Legacy aliases
+codex debug seatbelt [--full-auto] [COMMAND]...
codex debug landlock [--full-auto] [COMMAND]...
```
diff --git a/codex-rs/cli/src/main.rs b/codex-rs/cli/src/main.rs
index 79a187938a..04a7ff88f3 100644
--- a/codex-rs/cli/src/main.rs
+++ b/codex-rs/cli/src/main.rs
@@ -76,8 +76,9 @@ enum Subcommand {
/// Generate shell completion scripts.
Completion(CompletionCommand),
- /// Internal debugging commands.
- Debug(DebugArgs),
+ /// Run commands within a Codex-provided sandbox.
+ #[clap(visible_alias = "debug")]
+ Sandbox(SandboxArgs),
/// Apply the latest diff produced by Codex agent as a `git apply` to your local working tree.
#[clap(visible_alias = "a")]
@@ -121,18 +122,20 @@ struct ResumeCommand {
}
#[derive(Debug, Parser)]
-struct DebugArgs {
+struct SandboxArgs {
#[command(subcommand)]
- cmd: DebugCommand,
+ cmd: SandboxCommand,
}
#[derive(Debug, clap::Subcommand)]
-enum DebugCommand {
+enum SandboxCommand {
/// Run a command under Seatbelt (macOS only).
- Seatbelt(SeatbeltCommand),
+ #[clap(visible_alias = "seatbelt")]
+ Macos(SeatbeltCommand),
/// Run a command under Landlock+seccomp (Linux only).
- Landlock(LandlockCommand),
+ #[clap(visible_alias = "landlock")]
+ Linux(LandlockCommand),
}
#[derive(Debug, Parser)]
@@ -341,8 +344,8 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
);
codex_cloud_tasks::run_main(cloud_cli, codex_linux_sandbox_exe).await?;
}
- Some(Subcommand::Debug(debug_args)) => match debug_args.cmd {
- DebugCommand::Seatbelt(mut seatbelt_cli) => {
+ Some(Subcommand::Sandbox(sandbox_args)) => match sandbox_args.cmd {
+ SandboxCommand::Macos(mut seatbelt_cli) => {
prepend_config_flags(
&mut seatbelt_cli.config_overrides,
root_config_overrides.clone(),
@@ -353,7 +356,7 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
)
.await?;
}
- DebugCommand::Landlock(mut landlock_cli) => {
+ SandboxCommand::Linux(mut landlock_cli) => {
prepend_config_flags(
&mut landlock_cli.config_overrides,
root_config_overrides.clone(),
diff --git a/codex-rs/core/README.md b/codex-rs/core/README.md
index 9a4c255abe..8260fc1e79 100644
--- a/codex-rs/core/README.md
+++ b/codex-rs/core/README.md
@@ -12,7 +12,7 @@ Expects `/usr/bin/sandbox-exec` to be present.
### Linux
-Expects the binary containing `codex-core` to run the equivalent of `codex debug landlock` when `arg0` is `codex-linux-sandbox`. See the `codex-arg0` crate for details.
+Expects the binary containing `codex-core` to run the equivalent of `codex sandbox linux` (legacy alias: `codex debug landlock`) when `arg0` is `codex-linux-sandbox`. See the `codex-arg0` crate for details.
### All Platforms
diff --git a/docs/sandbox.md b/docs/sandbox.md
index 35f83eb7d3..711ecc8f25 100644
--- a/docs/sandbox.md
+++ b/docs/sandbox.md
@@ -69,9 +69,13 @@ To test to see what happens when a command is run under the sandbox provided by
```
# macOS
-codex debug seatbelt [--full-auto] [COMMAND]...
+codex sandbox macos [--full-auto] [COMMAND]...
# Linux
+codex sandbox linux [--full-auto] [COMMAND]...
+
+# Legacy aliases
+codex debug seatbelt [--full-auto] [COMMAND]...
codex debug landlock [--full-auto] [COMMAND]...
```