Commit Graph
1656 Commits
Author SHA1 Message Date
Michael Bolin ca5e62998a merge commit for archive created by Sapling 2025-06-02 23:38:43 -07:00
Michael Bolin 1f0f39ca58 fix: provide tolerance for apply_patch tool 2025-06-02 23:38:36 -07:00
Michael Bolin 364366b690 merge commit for archive created by Sapling 2025-06-02 23:26:58 -07:00
Michael Bolin bdb0bd4d76 fix: provide tolerance for apply_patch tool 2025-06-02 23:26:03 -07:00
Michael Bolin 741479f5f5 merge commit for archive created by Sapling 2025-06-02 22:42:36 -07:00
Michael Bolin 8940dbb12a fix: provide tolerance for apply_patch tool 2025-06-02 22:42:09 -07:00
Michael Bolin 743e580b33 merge commit for archive created by Sapling 2025-06-02 17:25:28 -07:00
Michael Bolin 51cbec2dc3 fix: provide tolerance for apply_patch tool 2025-06-02 17:25:05 -07:00
Michael Bolin 5a5aa89914 chore: replace regex with regex-lite, where appropriate (#1200)
As explained on https://crates.io/crates/regex-lite, `regex-lite` is a
lighter alternative to `regex` and seems to be sufficient for our
purposes.
2025-06-02 17:11:45 -07:00
Michael Bolin 2d6824040a merge commit for archive created by Sapling 2025-06-02 16:59:26 -07:00
Michael Bolin 956dc56a1f chore: replace regex with regex-lite, where appropriate 2025-06-02 16:58:49 -07:00
Michael Bolin 8691e269c4 Merge 0efbb7f7f1 into sapling-pr-archive-bolinfest 2025-06-02 16:56:39 -07:00
Michael Bolin 0efbb7f7f1 chore: replace regex with regex-lite, where appropriate 2025-06-02 16:56:32 -07:00
Michael Bolin 0f3cc8f842 feat: make reasoning effort/summaries configurable (#1199)
Previous to this PR, we always set `reasoning` when making a request
using the Responses API:


https://github.com/openai/codex/blob/d7245cbbc9d8ff5446da45e5951761103492476d/codex-rs/core/src/client.rs#L108-L111

Though if you tried to use the Rust CLI with `--model gpt-4.1`, this
would fail with:

```shell
"Unsupported parameter: 'reasoning.effort' is not supported with this model."
```

We take a cue from the TypeScript CLI, which does a check on the model
name:


https://github.com/openai/codex/blob/d7245cbbc9d8ff5446da45e5951761103492476d/codex-cli/src/utils/agent/agent-loop.ts#L786-L789

This PR does a similar check, though also adds support for the following
config options:

```
model_reasoning_effort = "low" | "medium" | "high" | "none"
model_reasoning_summary = "auto" | "concise" | "detailed" | "none"
```

This way, if you have a model whose name happens to start with `"o"` (or
`"codex"`?), you can set these to `"none"` to explicitly disable
reasoning, if necessary. (That said, it seems unlikely anyone would use
the Responses API with non-OpenAI models, but we provide an escape
hatch, anyway.)

This PR also updates both the TUI and `codex exec` to show `reasoning
effort` and `reasoning summaries` in the header.
2025-06-02 16:01:34 -07:00
Michael Bolin 76e0eba41c merge commit for archive created by Sapling 2025-06-02 15:49:23 -07:00
Michael Bolin 75266a1018 feat: make reasoning effort/summaries configurable 2025-06-02 15:49:16 -07:00
Michael Bolin cb57fd44a9 Merge 02cf240557 into sapling-pr-archive-bolinfest 2025-06-02 15:24:32 -07:00
Michael Bolin 02cf240557 feat: make reasoning effort/summaries configurable 2025-06-02 15:24:23 -07:00
Michael Bolin d7245cbbc9 fix: chat completions API now also passes tools along (#1167)
Prior to this PR, there were two big misses in `chat_completions.rs`:

1. The loop in `stream_chat_completions()` was only including items of
type `ResponseItem::Message` when building up the `"messages"` JSON for
the `POST` request to the `chat/completions` endpoint. This fixes things
by ensuring other variants (`FunctionCall`, `LocalShellCall`, and
`FunctionCallOutput`) are included, as well.
2. In `process_chat_sse()`, we were not recording tool calls and were
only emitting items of type
`ResponseEvent::OutputItemDone(ResponseItem::Message)` to the stream.
Now we introduce `FunctionCallState`, which is used to accumulate the
`delta`s of type `tool_calls`, so we can ultimately emit a
`ResponseItem::FunctionCall`, when appropriate.

While function calling now appears to work for chat completions with my
local testing, I believe that there are still edge cases that are not
covered and that this codepath would benefit from a battery of
integration tests. (As part of that further cleanup, we should also work
to support streaming responses in the UI.)

The other important part of this PR is some cleanup in
`core/src/codex.rs`. In particular, it was hard to reason about how
`run_task()` was building up the list of messages to include in a
request across the various cases:

- Responses API
- Chat Completions API
- Responses API used in concert with ZDR

I like to think things are a bit cleaner now where:

- `zdr_transcript` (if present) contains all messages in the history of
the conversation, which includes function call outputs that have not
been sent back to the model yet
- `pending_input` includes any messages the user has submitted while the
turn is in flight that need to be injected as part of the next `POST` to
the model
- `input_for_next_turn` includes the tool call outputs that have not
been sent back to the model yet
2025-06-02 13:47:51 -07:00
Michael Bolin 0789e6125e Merge a13a300e0f into sapling-pr-archive-bolinfest 2025-06-02 13:33:13 -07:00
Michael Bolin a13a300e0f fix: chat completions API to work with tools 2025-06-02 13:33:06 -07:00
Michael Bolin e40f86b446 chore: logging cleanup (#1196)
Update what we log to make `RUST_LOG=debug` a bit easier to work with.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1196).
* #1167
* __->__ #1196
2025-06-02 13:31:33 -07:00
Michael Bolin d4e9a81abc Merge 0b880458a7 into sapling-pr-archive-bolinfest 2025-06-02 13:19:18 -07:00
Michael Bolin 0b880458a7 fix: chat completions API to work with tools 2025-06-02 13:18:56 -07:00
Michael Bolin ee43e1b2d1 chore: logging cleanup
Update what we log to make `RUST_LOG=debug` a bit easier to work with.
2025-06-02 13:18:50 -07:00
Michael Bolin 54854e516a Merge e5f9b9ce92 into sapling-pr-archive-bolinfest 2025-06-02 13:17:23 -07:00
Michael Bolin e5f9b9ce92 fix: chat completions API to work with tools 2025-06-02 13:13:14 -07:00
Michael Bolin 7907ead08e merge commit for archive created by Sapling 2025-06-02 13:09:45 -07:00
Michael Bolin c16d2ce27e fix: chat completions API to work with tools 2025-06-02 13:09:39 -07:00
Michael Bolin b1b2ff50d9 merge commit for archive created by Sapling 2025-06-02 12:00:39 -07:00
Michael Bolin 55c0d4e9c1 fix: chat completions API to work with tools 2025-06-02 12:00:32 -07:00
Michael Bolin 7896b1089d chore: update the WORKFLOW_URL in install_native_deps.sh to the latest release (#1190) 2025-05-31 10:30:50 -07:00
Michael Bolin f1731e7cac Merge ce808d7cc6 into sapling-pr-archive-bolinfest 2025-05-31 10:24:26 -07:00
Michael Bolin ce808d7cc6 chore: update the WORKFLOW_URL in install_native_deps.sh to the latest release 2025-05-31 10:24:19 -07:00
Michael Bolin 1410ae95ca fix: set --config hide_agent_reasoning=true in the GitHub Action (#1185)
Whoops, I had this flipped in https://github.com/openai/codex/pull/1183.
2025-05-30 23:57:05 -07:00
Michael Bolin 4145e489c4 Merge 7bda9d1fbc into sapling-pr-archive-bolinfest 2025-05-30 23:56:32 -07:00
Michael Bolin 7bda9d1fbc fix: set --config hide_agent_reasoning=true in the GitHub Action 2025-05-30 23:56:23 -07:00
Michael Bolin a4a9204d2c Merge b7d9e36bbe into sapling-pr-archive-bolinfest 2025-05-30 23:50:21 -07:00
Michael Bolin b7d9e36bbe fix: chat completions API to work with tools 2025-05-30 23:50:16 -07:00
Michael Bolin fccf5f3221 fix: disable agent reasoning output by default in the GitHub Action (#1183) 2025-05-30 23:49:48 -07:00
Michael Bolin 0f5319714d merge commit for archive created by Sapling 2025-05-30 23:41:34 -07:00
Michael Bolin 9358392237 fix: disable agent reasoning output by default in the GitHub Action 2025-05-30 23:41:27 -07:00
Michael Bolin 2df6e07bed Merge 953fd5324b into sapling-pr-archive-bolinfest 2025-05-30 23:32:08 -07:00
Michael Bolin 953fd5324b fix: disable agent reasoning output by default in the GitHub Action 2025-05-30 23:30:33 -07:00
Michael Bolin 1159eaf04f feat: show the version when starting Codex (#1182)
The TypeScript version of the CLI shows the version when it starts up,
which is helpful when users share screenshots (and nice to know, as a
user).
codex-rs-ca8e97fcbcb991e542b8689f2d4eab9d30c399d6-1-rust-v0.0.2505302325
2025-05-30 23:24:36 -07:00
Michael Bolin ccdf43699d Merge 1bda6e0da5 into sapling-pr-archive-bolinfest 2025-05-30 23:22:00 -07:00
Michael Bolin 1bda6e0da5 feat: show the version when starting Codex 2025-05-30 23:21:46 -07:00
Michael Bolin e81327e5f4 feat: add hide_agent_reasoning config option (#1181)
This PR introduces a `hide_agent_reasoning` config option (that defaults
to `false`) that users can enable to make the output less verbose by
suppressing reasoning output.

To test, verified that this includes agent reasoning in the output:

```
echo hello | just exec
```

whereas this does not:

```
echo hello | just exec --config hide_agent_reasoning=false
```
2025-05-30 23:14:56 -07:00
Michael Bolin 67915b460b Merge 6576c6292c into sapling-pr-archive-bolinfest 2025-05-30 23:11:59 -07:00
Michael Bolin 6576c6292c feat: add hide_agent_reasoning config option 2025-05-30 23:11:55 -07:00