Commit Graph

464 Commits

Author SHA1 Message Date
Michael Bolin
f0c0b77a9d merge commit for archive created by Sapling 2025-04-29 11:09:01 -07:00
Michael Bolin
566cd27a0e feat: flip the sense of the --sandbox option 2025-04-29 11:08:53 -07:00
Michael Bolin
99676c7506 Merge febc95ce1d into sapling-pr-archive-bolinfest 2025-04-29 11:01:02 -07:00
Michael Bolin
febc95ce1d feat: flip the sense of the --sandbox option 2025-04-29 11:00:43 -07:00
Michael Bolin
3b39964f81 feat: improve output of exec subcommand (#719) 2025-04-29 09:59:35 -07:00
Rashim
892242ef7c feat: add --reasoning CLI flag (#314)
This PR adds a new CLI flag: `--reasoning`, which allows users to
customize the reasoning effort level (`low`, `medium`, or `high`) used
by OpenAI's `o` models.
By introducing the `--reasoning` flag, users gain more flexibility when
working with the models. It enables optimization for either speed or
depth of reasoning, depending on specific use cases.
This PR resolves #107

- **Flag**: `--reasoning`
- **Accepted Values**: `low`, `medium`, `high`
- **Default Behavior**: If not specified, the model uses the default
reasoning level.

## Example Usage

```bash
codex --reasoning=low "Write a simple function to calculate factorial"

---------

Co-authored-by: Fouad Matin <169186268+fouad-openai@users.noreply.github.com>
Co-authored-by: yashrwealthy <yash.rastogi@wealthy.in>
Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-29 07:30:49 -07:00
Michael Bolin
212784dc8b merge commit for archive created by Sapling 2025-04-28 23:57:20 -07:00
Michael Bolin
493e1b477c feat: improve output of exec subcommand 2025-04-28 23:57:14 -07:00
Michael Bolin
d362978afe merge commit for archive created by Sapling 2025-04-28 23:54:22 -07:00
Michael Bolin
65ec055195 feat: improve output of exec subcommand 2025-04-28 23:54:10 -07:00
Michael Bolin
7bb0f0045c merge commit for archive created by Sapling 2025-04-28 23:35:59 -07:00
Michael Bolin
9579f05363 feat: improve output of exec subcommand 2025-04-28 23:35:54 -07:00
Michael Bolin
e0b1860777 merge commit for archive created by Sapling 2025-04-28 23:12:14 -07:00
Michael Bolin
8ef2b38286 feat: improve output of exec subcommand 2025-04-28 23:12:08 -07:00
Fouad Matin
19928bc257 [codex-rs] fix: exit code 1 if no api key (#697) 2025-04-28 21:42:06 -07:00
Michael Bolin
b9bba09819 fix: eliminate runtime dependency on patch(1) for apply_patch (#718)
When processing an `apply_patch` tool call, we were already computing
the new file content in order to compute the unified diff. Before this
PR, we were shelling out to `patch(1)` to apply the unified diff once
the user accepted the change, but this updates the code to just retain
the new file content and use it to write the file when the user accepts.
This simplifies deployment because it no longer assumes `patch(1)` is on
the host.

Note this change is internal to the Codex agent and does not affect
`protocol.rs`.
2025-04-28 21:15:41 -07:00
Thibault Sottiaux
d09dbba7ec feat: lower default retry wait time and increase number of tries (#720)
In total we now guarantee that we will wait for at least 60s before
giving up.

---------

Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-28 21:11:30 -07:00
Michael Bolin
c850a20fc9 merge commit for archive created by Sapling 2025-04-28 17:14:12 -07:00
Michael Bolin
2df38990ad feat: improve output of exec subcommand 2025-04-28 17:13:27 -07:00
Michael Bolin
02109fd81d Merge 3b4093de65 into sapling-pr-archive-bolinfest 2025-04-28 17:08:24 -07:00
Michael Bolin
3b4093de65 feat: improve output of exec subcommand 2025-04-28 17:06:05 -07:00
Michael Bolin
e79549f039 feat: add debug landlock subcommand comparable to debug seatbelt (#715)
This PR adds a `debug landlock` subcommand to the Codex CLI for testing
how Codex would execute a command using the specified sandbox policy.

Built and ran this code in the `rust:latest` Docker container. In the
container, hitting the network with vanilla `curl` succeeds:

```
$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
```

whereas this fails, as expected:

```
$ cargo run -- debug landlock -s network-restricted -- curl google.com
curl: (6) getaddrinfo() thread failed to start
```
2025-04-28 16:37:05 -07:00
Michael Bolin
26eef5c10b Merge 481f07a0db into sapling-pr-archive-bolinfest 2025-04-28 16:36:55 -07:00
Michael Bolin
481f07a0db fix: eliminate runtime dependency on patch(1) for apply_patch 2025-04-28 16:36:44 -07:00
Michael Bolin
edcb95e8f9 Merge d1abb9f6cd into sapling-pr-archive-bolinfest 2025-04-28 15:46:55 -07:00
Michael Bolin
d1abb9f6cd feat: add debug landlock subcommand comparable to debug seatbelt 2025-04-28 15:46:46 -07:00
Michael Bolin
1095fe8001 merge commit for archive created by Sapling 2025-04-28 15:42:39 -07:00
Michael Bolin
7b98df230c feat: add debug landlock subcommand comparable to debug seatbelt 2025-04-28 15:42:35 -07:00
Michael Bolin
e7ad9449ea feat: make it possible to set disable_response_storage = true in config.toml (#714)
https://github.com/openai/codex/pull/642 introduced support for the
`--disable-response-storage` flag, but if you are a ZDR customer, it is
tedious to set this every time, so this PR makes it possible to set this
once in `config.toml` and be done with it.

Incidentally, this tidies things up such that now `init_codex()` takes
only one parameter: `Config`.
2025-04-28 15:39:34 -07:00
Michael Bolin
333d2079a1 merge commit for archive created by Sapling 2025-04-28 15:38:57 -07:00
Michael Bolin
221f92debc feat: add debug landlock subcommand comparable to debug seatbelt 2025-04-28 15:38:49 -07:00
Michael Bolin
ba8cd0061e Merge 8d57637549 into sapling-pr-archive-bolinfest 2025-04-28 15:03:35 -07:00
Michael Bolin
8d57637549 feat: add debug landlock subcommand comparable to debug seatbelt 2025-04-28 15:03:27 -07:00
Michael Bolin
750f31e3c0 merge commit for archive created by Sapling 2025-04-28 13:46:38 -07:00
Michael Bolin
08d4748dff feat: make it possible to set disable_response_storage = true in config.toml 2025-04-28 13:46:32 -07:00
Michael Bolin
cca1122ddc fix: make the TUI the default/"interactive" CLI in Rust (#711)
Originally, the `interactive` crate was going to be a placeholder for
building out a UX that was comparable to that of the existing TypeScript
CLI. Though after researching how Ratatui works, that seems difficult to
do because it is designed around the idea that it will redraw the full
screen buffer each time (and so any scrolling should be "internal" to
your Ratatui app) whereas the TypeScript CLI expects to render the full
history of the conversation every time(*) (which is why you can use your
terminal scrollbar to scroll it).

While it is possible to use Ratatui in a way that acts more like what
the TypeScript CLI is doing, it is awkward and seemingly results in
tedious code, so I think we should abandon that approach. As such, this
PR deletes the `interactive/` folder and the code that depended on it.

Further, since we added support for mousewheel scrolling in the TUI in
https://github.com/openai/codex/pull/641, it certainly feels much better
and the need for scroll support via the terminal scrollbar is greatly
diminished. This is now a more appropriate default UX for the
"multitool" CLI.

(*) Incidentally, I haven't verified this, but I think this results in
O(N^2) work in rendering, which seems potentially problematic for long
conversations.
2025-04-28 13:46:22 -07:00
Michael Bolin
40460faf2a fix: tighten up check for /usr/bin/sandbox-exec (#710)
* In both TypeScript and Rust, we now invoke `/usr/bin/sandbox-exec`
explicitly rather than whatever `sandbox-exec` happens to be on the
`PATH`.
* Changed `isSandboxExecAvailable` to use `access()` rather than
`command -v` so that:
  *  We only do the check once over the lifetime of the Codex process.
  * The check is specific to `/usr/bin/sandbox-exec`.
* We now do a syscall rather than incur the overhead of spawning a
process, dealing with timeouts, etc.

I think there is still room for improvement here where we should move
the `isSandboxExecAvailable` check earlier in the CLI, ideally right
after we do arg parsing to verify that we can provide the Seatbelt
sandbox if that is what the user has requested.
2025-04-28 13:42:04 -07:00
Michael Bolin
19251bb234 Merge 1e5d059dce into sapling-pr-archive-bolinfest 2025-04-28 13:37:40 -07:00
Michael Bolin
1e5d059dce fix: tighten up check for /usr/bin/sandbox-exec 2025-04-28 13:37:28 -07:00
Michael Bolin
25ef01f8c0 Merge 8ab5a4793b into sapling-pr-archive-bolinfest 2025-04-28 13:37:22 -07:00
Michael Bolin
8ab5a4793b fix: make the TUI the default/"interactive" CLI 2025-04-28 13:37:16 -07:00
Michael Bolin
3933ade4f6 Merge 6bda0d3096 into sapling-pr-archive-bolinfest 2025-04-28 13:36:40 -07:00
Michael Bolin
6bda0d3096 feat: make it possible to set disable_response_storage = true in config.toml 2025-04-28 13:36:33 -07:00
Michael Bolin
38575ed8aa fix: increase timeout of test_writable_root (#713)
Although we made some promising fixes in
https://github.com/openai/codex/pull/662, we are still seeing some
flakiness in `test_writable_root()`. If this continues to flake with the
more generous timeout, we should try something other than simply
increasing the timeout.
2025-04-28 13:09:27 -07:00
Michael Bolin
fedf79574c Merge 835df9e5dd into sapling-pr-archive-bolinfest 2025-04-28 13:06:10 -07:00
Michael Bolin
835df9e5dd fix: increase timeout of test_writable_root 2025-04-28 13:06:02 -07:00
Michael Bolin
d4df003be9 Merge f5d320beaa into sapling-pr-archive-bolinfest 2025-04-28 12:35:36 -07:00
Michael Bolin
f5d320beaa fix: make the TUI the default/"interactive" CLI 2025-04-28 12:35:29 -07:00
Michael Bolin
c46d362dc2 merge commit for archive created by Sapling 2025-04-28 12:24:58 -07:00
Michael Bolin
15e3d634d8 fix: tighten up check for /usr/bin/sandbox-exec 2025-04-28 12:24:53 -07:00