Commit Graph
1502 Commits
Author SHA1 Message Date
Michael Bolin e5c71e2304 merge commit for archive created by Sapling 2025-05-27 22:16:05 -07:00
Michael Bolin 6d4baff7d4 feat: add support for -c/--config to override individual config items 2025-05-27 22:15:58 -07:00
Michael Bolin adc672476f merge commit for archive created by Sapling 2025-05-27 22:00:18 -07:00
Michael Bolin fd8e479435 feat: add support for -c/--config to override individual config items 2025-05-27 21:59:13 -07:00
Michael Bolin 44b153aee4 merge commit for archive created by Sapling 2025-05-27 21:44:25 -07:00
Michael Bolin 57d7987942 feat: add support for -c/--config to override individual config items 2025-05-27 21:44:14 -07:00
Michael Bolin 9cc192a35c merge commit for archive created by Sapling 2025-05-27 17:57:27 -07:00
Michael Bolin b8b755e060 feat: add support for -c/--config to override individual config items 2025-05-27 17:57:19 -07:00
Michael Bolin 8202e24478 merge commit for archive created by Sapling 2025-05-27 17:46:26 -07:00
Michael Bolin 24a6334688 feat: add support for -c/--config to override individual config items 2025-05-27 17:46:18 -07:00
Michael Bolin af0cfc78d9 merge commit for archive created by Sapling 2025-05-27 14:26:45 -07:00
Michael Bolin ee21a61978 feat: add support for -c/--config to override individual config items 2025-05-27 14:26:36 -07:00
Michael Bolin 70026fb7fe merge commit for archive created by Sapling 2025-05-27 12:55:24 -07:00
Michael Bolin b9302c46d3 feat: add support for -c/--config to override individual config items 2025-05-27 12:55:17 -07:00
Michael Bolin d7e8f05f2a merge commit for archive created by Sapling 2025-05-27 11:31:53 -07:00
Michael Bolin a9409dc175 feat: add support for -c/--config to override individual config items 2025-05-27 11:31:47 -07:00
Michael Bolin c9e942b6da merge commit for archive created by Sapling 2025-05-27 11:03:30 -07:00
Michael Bolin 2a797839ed feat: add support for -c/--config to override individual config items 2025-05-27 11:03:21 -07:00
Michael Bolin b68a9274d8 Merge 1c9594b18b into sapling-pr-archive-bolinfest 2025-05-27 10:46:14 -07:00
Michael Bolin 1c9594b18b feat: add support for -c/--config to override individual config items 2025-05-27 10:46:05 -07:00
Michael Bolin cfbb9c263c Merge 6f2e5ea72e into sapling-pr-archive-bolinfest 2025-05-27 09:36:19 -07:00
Michael Bolin 6f2e5ea72e fix: update install_native_deps.sh to pick up the latest release 2025-05-27 09:36:12 -07:00
Michael Bolin 29d154cb13 fix: use o4-mini as the default model (#1135)
Rollback of https://github.com/openai/codex/pull/972.
codex-rs-d519bd8bbd1e1fd9efdc5d68cf7bebdec0dd0f28-1-rust-v0.0.2505270918
2025-05-27 09:12:55 -07:00
Michael Bolin 50ee614110 Merge 4115a04aff into sapling-pr-archive-bolinfest 2025-05-27 09:01:59 -07:00
Michael Bolin 4115a04aff fix: use o4-mini as the default model 2025-05-27 09:01:51 -07:00
Michael Bolin 6b5b184f21 fix: TUI was not honoring --skip-git-repo-check correctly (#1105)
I discovered that if I ran `codex <PROMPT>` in a cwd that was not a Git
repo, Codex did not automatically run `<PROMPT>` after I accepted the
Git warning. It appears that we were not managing the `AppState`
transition correctly, so this fixes the bug and ensures the Codex
session does not start until the user accepts the Git warning.

In particular, we now create the `ChatWidget` lazily and store it in the
`AppState::Chat` variant.
2025-05-24 08:33:49 -07:00
Michael Bolin f2626563c3 Merge 1487ed045c into sapling-pr-archive-bolinfest 2025-05-24 08:30:04 -07:00
Michael Bolin 1487ed045c fix: TUI was not honoring --skip-git-repo-check correctly 2025-05-24 08:29:58 -07:00
Michael Bolin 4bf81373a7 fix: forgot to pass codex_linux_sandbox_exe through in cli/src/debug_sandbox.rs (#1095)
I accidentally missed this in https://github.com/openai/codex/pull/1086.
codex-rs-aa156ceac953c3e6f3602e6eb2f61b14ac8adaf3-1-rust-v0.0.2505231205
2025-05-23 11:53:13 -07:00
Michael Bolin a1bb0e1a8e merge commit for archive created by Sapling 2025-05-23 11:50:23 -07:00
Michael Bolin 7463b984ec fix: forgot to pass codex_linux_sandbox_exe through in cli/src/debug_sandbox.rs 2025-05-23 11:50:15 -07:00
Michael Bolin 89ef4efdcf fix: overhaul how we spawn commands under seccomp/landlock on Linux (#1086)
Historically, we spawned the Seatbelt and Landlock sandboxes in
substantially different ways:

For **Seatbelt**, we would run `/usr/bin/sandbox-exec` with our policy
specified as an arg followed by the original command:


https://github.com/openai/codex/blob/d1de7bb383552e8fadd94be79d65d188e00fd562/codex-rs/core/src/exec.rs#L147-L219

For **Landlock/Seccomp**, we would do
`tokio::runtime::Builder::new_current_thread()`, _invoke
Landlock/Seccomp APIs to modify the permissions of that new thread_, and
then spawn the command:


https://github.com/openai/codex/blob/d1de7bb383552e8fadd94be79d65d188e00fd562/codex-rs/core/src/exec_linux.rs#L28-L49

While it is neat that Landlock/Seccomp supports applying a policy to
only one thread without having to apply it to the entire process, it
requires us to maintain two different codepaths and is a bit harder to
reason about. The tipping point was
https://github.com/openai/codex/pull/1061, in which we had to start
building up the `env` in an unexpected way for the existing
Landlock/Seccomp approach to continue to work.

This PR overhauls things so that we do similar things for Mac and Linux.
It turned out that we were already building our own "helper binary"
comparable to Mac's `sandbox-exec` as part of the `cli` crate:


https://github.com/openai/codex/blob/d1de7bb383552e8fadd94be79d65d188e00fd562/codex-rs/cli/Cargo.toml#L10-L12

We originally created this to build a small binary to include with the
Node.js version of the Codex CLI to provide support for Linux
sandboxing.

Though the sticky bit is that, at this point, we still want to deploy
the Rust version of Codex as a single, standalone binary rather than a
CLI and a supporting sandboxing binary. To satisfy this goal, we use
"the arg0 trick," in which we:

* use `std::env::current_exe()` to get the path to the CLI that is
currently running
* use the CLI as the `program` for the `Command`
* set `"codex-linux-sandbox"` as arg0 for the `Command`

A CLI that supports sandboxing should check arg0 at the start of the
program. If it is `"codex-linux-sandbox"`, it must invoke
`codex_linux_sandbox::run_main()`, which runs the CLI as if it were
`codex-linux-sandbox`. When acting as `codex-linux-sandbox`, we make the
appropriate Landlock/Seccomp API calls and then use `execvp(3)` to spawn
the original command, so do _replace_ the process rather than spawn a
subprocess. Incidentally, we do this before starting the Tokio runtime,
so the process should only have one thread when `execvp(3)` is called.

Because the `core` crate that needs to spawn the Linux sandboxing is not
a CLI in its own right, this means that every CLI that includes `core`
and relies on this behavior has to (1) implement it and (2) provide the
path to the sandboxing executable. While the path is almost always
`std::env::current_exe()`, we needed to make this configurable for
integration tests, so `Config` now has a `codex_linux_sandbox_exe:
Option<PathBuf>` property to facilitate threading this through,
introduced in https://github.com/openai/codex/pull/1089.

This common pattern is now captured in
`codex_linux_sandbox::run_with_sandbox()` and all of the `main.rs`
functions that should use it have been updated as part of this PR.

The `codex-linux-sandbox` crate added to the Cargo workspace as part of
this PR now has the bulk of the Landlock/Seccomp logic, which makes
`core` a bit simpler. Indeed, `core/src/exec_linux.rs` and
`core/src/landlock.rs` were removed/ported as part of this PR. I also
moved the unit tests for this code into an integration test,
`linux-sandbox/tests/landlock.rs`, in which I use
`env!("CARGO_BIN_EXE_codex-linux-sandbox")` as the value for
`codex_linux_sandbox_exe` since `std::env::current_exe()` is not
appropriate in that case.
codex-rs-d2eee362c1c6cdc00bcb5bf1d479823ef33c143a-1-rust-v0.0.2505231137
2025-05-23 11:37:07 -07:00
Michael Bolin 072e6b01e8 merge commit for archive created by Sapling 2025-05-23 11:13:01 -07:00
Michael Bolin e1b4dbeddb fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-23 11:12:54 -07:00
Michael Bolin a16229789f merge commit for archive created by Sapling 2025-05-23 10:49:30 -07:00
Michael Bolin 532d703db9 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-23 10:49:24 -07:00
Michael Bolin 750168c20c merge commit for archive created by Sapling 2025-05-23 10:14:38 -07:00
Michael Bolin adc5de2703 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-23 10:14:32 -07:00
Michael Bolin 7930bb835c merge commit for archive created by Sapling 2025-05-23 09:56:22 -07:00
Michael Bolin 06dc2113a6 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-23 09:56:16 -07:00
Michael Bolin ee1c53dd85 merge commit for archive created by Sapling 2025-05-23 09:47:09 -07:00
Michael Bolin 24e2180f21 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-23 09:47:02 -07:00
Michael Bolin 0bb7fccc1c merge commit for archive created by Sapling 2025-05-22 23:29:48 -07:00
Michael Bolin a2cc00b5d1 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-22 23:29:27 -07:00
Michael Bolin d1de7bb383 feat: add codex_linux_sandbox_exe: Option<PathBuf> field to Config (#1089)
https://github.com/openai/codex/pull/1086 is a work-in-progress to make
Linux sandboxing work more like Seatbelt where, for the command we want
to sandbox, we build up the command and then hand it, and some sandbox
configuration flags, to another command to set up the sandbox and then
run it.

In the case of Seatbelt, macOS provides this helper binary and provides
it at `/usr/bin/sandbox-exec`. For Linux, we have to build our own and
pass it through (which is what #1086 does), so this makes the new
`codex_linux_sandbox_exe` available on `Config` so that it will later be
available in `exec.rs` when we need it in #1086.
2025-05-22 21:52:28 -07:00
Michael Bolin f79473c187 merge commit for archive created by Sapling 2025-05-22 21:46:55 -07:00
Michael Bolin 6f7c6142f8 feat: add codex_linux_sandbox_exe: Option<PathBuf> field to Config 2025-05-22 21:46:48 -07:00
Michael Bolin 21fd1581c2 merge commit for archive created by Sapling 2025-05-22 20:39:49 -07:00
Michael Bolin c11c9ccd09 fix: overhaul how we spawn commands under seccomp/landlock on Linux 2025-05-22 20:39:43 -07:00
Michael Bolin bbb9d7d8fb merge commit for archive created by Sapling 2025-05-22 19:58:28 -07:00