Commit Graph
2597 Commits
Author SHA1 Message Date
aibrahim-oai 19bef7659f Serializing the eventmsg type to snake_case (#1709)
This was an abrupt change on our clients. We need to serialize as
snake_case.
2025-07-28 10:26:27 -07:00
Michael Bolin 5ebb7dd34c chore: split apply_patch logic out of codex.rs and into apply_patch.rs (#1703)
This is a straight refactor, moving apply-patch-related code from
`codex.rs` and into the new `apply_patch.rs` file. The only "logical"
change is inlining `#[allow(clippy::unwrap_used)]` instead of declaring
`#![allow(clippy::unwrap_used)]` at the top of the file (which is
currently the case in `codex.rs`).

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1703).
* #1705
* __->__ #1703
* #1702
* #1698
* #1697
2025-07-28 09:51:22 -07:00
Michael Bolin 181dd70726 Merge 787b7a7ca4 into sapling-pr-archive-bolinfest 2025-07-28 09:27:16 -07:00
Michael Bolin 787b7a7ca4 fix: run apply_patch calls through the sandbox 2025-07-28 09:26:56 -07:00
Michael Bolin 527b96a465 chore: split apply_patch logic out of codex.rs and into apply_patch.rs 2025-07-28 09:26:56 -07:00
Michael Bolin d76f96ce79 fix: support special --codex-run-as-apply-patch arg (#1702)
This introduces some special behavior to the CLIs that are using the
`codex-arg0` crate where if `arg1` is `--codex-run-as-apply-patch`, then
it will run as if `apply_patch arg2` were invoked. This is important
because it means we can do things like:

```
SANDBOX_TYPE=landlock # or seatbelt for macOS
codex debug "${SANDBOX_TYPE}" -- codex --codex-run-as-apply-patch PATCH
```

which gives us a way to run `apply_patch` while ensuring it adheres to
the sandbox the user specified.

While it would be nice to use the `arg0` trick like we are currently
doing for `codex-linux-sandbox`, there is no way to specify the `arg0`
for the underlying command when running under `/usr/bin/sandbox-exec`,
so it will not work for us in this case.

Admittedly, we could have also supported this via a custom environment
variable (e.g., `CODEX_ARG0`), but since environment variables are
inherited by child processes, that seemed like a potentially leakier
abstraction.

This change, as well as our existing reliance on checking `arg0`, place
additional requirements on those who include `codex-core`. Its
`README.md` has been updated to reflect this.

While we could have just added an `apply-patch` subcommand to the
`codex` multitool CLI, that would not be sufficient for the standalone
`codex-exec` CLI, which is something that we distribute as part of our
GitHub releases for those who know they will not be using the TUI and
therefore prefer to use a slightly smaller executable:

https://github.com/openai/codex/releases/tag/rust-v0.10.0

To that end, this PR adds an integration test to ensure that the
`--codex-run-as-apply-patch` option works with the standalone
`codex-exec` CLI.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1702).
* #1705
* #1703
* __->__ #1702
* #1698
* #1697
2025-07-28 09:26:44 -07:00
Michael Bolin aff7087ae7 Merge 73a21d0a10 into sapling-pr-archive-bolinfest 2025-07-28 08:53:23 -07:00
Michael Bolin 73a21d0a10 fix: run apply_patch calls through the sandbox 2025-07-28 08:53:04 -07:00
Michael Bolin 1b1d4b69a6 chore: split apply_patch logic out of codex.rs and into apply_patch.rs 2025-07-28 08:53:04 -07:00
Michael Bolin c637d0e9a3 fix: support special --codex-run-as-apply-patch arg 2025-07-28 08:53:04 -07:00
Michael Bolin fcd197d596 fix: use std::env::args_os instead of std::env::args (#1698)
Apparently `std::env::args()` will panic during iteration if any
argument to the process is not valid Unicode:

https://doc.rust-lang.org/std/env/fn.args.html

Let's avoid the risk and just go with `std::env::args_os()`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1698).
* #1705
* #1703
* #1702
* __->__ #1698
* #1697
2025-07-28 08:52:18 -07:00
Michael Bolin ed746c7e2d Merge 99608d5e27 into sapling-pr-archive-bolinfest 2025-07-28 08:34:07 -07:00
Michael Bolin 99608d5e27 fix: run apply_patch calls through the sandbox 2025-07-28 08:32:57 -07:00
Michael Bolin 2d190ae8c5 chore: split apply_patch logic out of codex.rs and into apply_patch.rs 2025-07-28 08:32:57 -07:00
Michael Bolin bdb7f8e138 fix: support special --codex-run-as-apply-patch arg 2025-07-28 08:32:57 -07:00
Michael Bolin fc25aa6e05 fix: use std::env::args_os instead of std::env::args 2025-07-28 08:32:57 -07:00
Michael Bolin 9102255854 fix: move arg0 handling out of codex-linux-sandbox and into its own crate (#1697) 2025-07-28 08:31:24 -07:00
Jeremy Rose 7ecd3153a8 fix: correctly wrap history items (#1685)
The overall idea here is: skip ratatui for writing into scrollback,
because its primitives are wrong. We want to render full lines of text,
that will be wrapped natively by the terminal, and which we never plan
to update using ratatui (so the `Buffer` struct is overhead and in fact
an inhibition).

Instead, we use ANSI scrolling regions (link reference doc to come).
Essentially, we:
1. Define a scrolling region that extends from the top of the prompt
area all the way to the top of scrollback
2. Scroll that region up by N < (screen_height - viewport_height) lines,
in this PR N=1
3. Put our cursor at the top of the newly empty region
4. Print out our new text like normal

The terminal interactions here (write_spans and its dependencies) are
mostly extracted from ratatui.
2025-07-28 14:45:49 +00:00
Michael Bolin a27311ab62 Merge 68076e61f3 into sapling-pr-archive-bolinfest 2025-07-28 00:05:02 -07:00
Michael Bolin 68076e61f3 fix: run apply_patch calls through the sandbox 2025-07-28 00:04:35 -07:00
Michael Bolin 2011143443 Merge 4bb86857c1 into sapling-pr-archive-bolinfest 2025-07-27 23:01:05 -07:00
Michael Bolin 4bb86857c1 chore: split apply_patch logic out of codex.rs and into apply_patch.rs 2025-07-27 23:00:46 -07:00
Michael Bolin a05a3c7daa merge commit for archive created by Sapling 2025-07-27 22:46:00 -07:00
Michael Bolin d48e2abe9a fix: support special --codex-run-as-apply-patch arg 2025-07-27 22:45:43 -07:00
Michael Bolin 0f314f2490 merge commit for archive created by Sapling 2025-07-27 22:28:58 -07:00
Michael Bolin 207aae4671 fix: support special --codex-run-as-apply-patch arg 2025-07-27 22:28:30 -07:00
Michael Bolin 0649ec9ad3 fix: use std::env::args_os instead of std::env::args 2025-07-27 21:58:43 -07:00
Michael Bolin ec40bc516b Merge c26b617754 into sapling-pr-archive-bolinfest 2025-07-27 21:37:16 -07:00
Michael Bolin c26b617754 fix: use std::env::args_os instead of std::env::args 2025-07-27 21:37:05 -07:00
Michael Bolin 77066196eb Merge c33762dd94 into sapling-pr-archive-bolinfest 2025-07-27 21:21:56 -07:00
Michael Bolin c33762dd94 fix: use std::env::args_os instead of std::env::args 2025-07-27 21:21:27 -07:00
Michael Bolin cb9b804992 merge commit for archive created by Sapling 2025-07-27 21:12:32 -07:00
Michael Bolin d75c131584 fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 21:12:17 -07:00
Michael Bolin 6438fd126e merge commit for archive created by Sapling 2025-07-27 21:12:04 -07:00
Michael Bolin 66309d9f0e fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 21:11:44 -07:00
Michael Bolin 9090a43c5d merge commit for archive created by Sapling 2025-07-27 20:33:27 -07:00
Michael Bolin f07838112a fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 20:33:08 -07:00
Michael Bolin 9742bd1cd3 Merge aa8fa29be3 into sapling-pr-archive-bolinfest 2025-07-27 20:07:40 -07:00
Michael Bolin aa8fa29be3 fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 20:07:24 -07:00
Michael Bolin 8ef8f1e844 Merge 0633a09184 into sapling-pr-archive-bolinfest 2025-07-27 20:05:36 -07:00
Michael Bolin 0633a09184 fix: move arg0 handling out of codex-linux-sandbox and into its own crate 2025-07-27 20:05:19 -07:00
Michael Bolin 2405c40026 chore: update Codex::spawn() to return a struct instead of a tuple (#1677)
Also update `init_codex()` to return a `struct` instead of a tuple, as well.
2025-07-27 20:01:35 -07:00
easong-openai 58bed77ba7 Remove tab focus switching (#1694)
Previously pressing tab would switch TUI focus to the history scrollbox - no longer necessary.
2025-07-27 11:04:09 -07:00
Michael Bolin add023895f merge commit for archive created by Sapling 2025-07-26 19:58:32 -07:00
Michael Bolin 073dc04190 chore: update Codex::spawn() to return a struct instead of a tuple 2025-07-26 19:57:58 -07:00
aibrahim-oai 5a0079fea2 Changing method in MCP notifications (#1684)
- Changing the codex/event type
2025-07-26 10:35:49 -07:00
Jeremy Rose c66c99c5b5 fix: crash on resize (#1683)
Without this, resizing the terminal prints "Error: The cursor position
could not be read within a normal duration" and quits the app.
2025-07-25 14:23:38 -07:00
Jeremy Rose 75b4008094 fix: paste with newlines (#1682)
This fixes an issue where pasting multi-line content would break the
composer.
2025-07-25 19:26:40 +00:00
pakrym-oai 7ee87123a6 Optionally run using user profile (#1678) 2025-07-25 11:45:23 -07:00
Michael Bolin 994c9a874d chore: use one write call per item in rollout_writer() (#1679)
Most of the time, we expect the `String` returned by
`serde_json::to_string()` to have extra capacity, so `push('\n')` is
unlikely to allocate, which seems cheaper than an extra `write(2)` call,
on average?
2025-07-25 10:43:36 -07:00