Commit Graph
2585 Commits
Author SHA1 Message Date
Dylan aff97ed7dd [core] Separate tools config from openai client (#1858)
## Summary
In an effort to make tools easier to work with and more configurable,
I'm introducing `ToolConfig` and updating `Prompt` to take in a general
list of Tools. I think this is simpler and better for a few reasons:
- We can easily assemble tools from various sources (our own harness,
mcp servers, etc.) and we can consolidate the logic for constructing the
logic in one place that is separate from serialization.
- client.rs no longer needs arbitrary config values, it just takes in a
list of tools to serialize

A hefty portion of the PR is now updating our conversion of
`mcp_types::Tool` to `OpenAITool`, but considering that @bolinfest
accurately called this out as a TODO long ago, I think it's time we
tackled it.

## Testing
- [x] Experimented locally, no changes, as expected
- [x] Added additional unit tests
- [x] Responded to rust-review
2025-08-05 19:27:52 -07:00
Michael Bolin afa8f0d617 fix: exit cleanly when ShutdownComplete is received (#1864)
Previous to this PR, `ShutdownComplete` was not being handled correctly
in `codex exec`, so it always ended up printing the following to stderr:

```
ERROR codex_exec: Error receiving event: InternalAgentDied
```

Because we were not breaking out of the loop for `ShutdownComplete`,
inevitably `codex.next_event()` would get called again and
`rx_event.recv()` would fail and the error would get mapped to
`InternalAgentDied`:


https://github.com/openai/codex/blob/ea7d3f27bdc1da61df979419515889f64f36c5ce/codex-rs/core/src/codex.rs#L190-L197

For reference, https://github.com/openai/codex/pull/1647 introduced the
`ShutdownComplete` variant.
2025-08-05 19:19:36 -07:00
Michael Bolin d2cb167943 Merge de81606a39 into sapling-pr-archive-bolinfest 2025-08-05 18:44:17 -07:00
Michael Bolin de81606a39 fix: exit cleanly when ShutdownComplete is received 2025-08-05 18:43:59 -07:00
Dylan ea7d3f27bd [core] Stop escalating timeouts (#1853)
## Summary
Escalating out of sandbox is (almost always) not going to fix
long-running commands timing out - therefore we should just pass the
failure back to the model instead of asking the user to re-run a command
that took a long time anyway.

## Testing
- [x] Ran locally with a timeout and confirmed this worked as expected
2025-08-05 17:52:25 -07:00
ae f6c8d1117c [feat] make approval key matching case insensitive (#1862) 2025-08-05 15:50:06 -07:00
Michael Bolin 42bd73e150 chore: remove unnecessary default_ prefix (#1854)
This prefix is not inline with the other fields on the `ConfigOverrides`
struct.
2025-08-05 14:42:49 -07:00
Michael Bolin 03ced80d9a Merge 9ff7306219 into sapling-pr-archive-bolinfest 2025-08-05 13:58:28 -07:00
Michael Bolin 9ff7306219 chore: remove unnecessary default_ prefix 2025-08-05 13:58:08 -07:00
Michael Bolin d365cae077 fix: when using --oss, ensure correct configuration is threaded through correctly (#1859)
This PR started as an investigation with the goal of eliminating the use
of `unsafe { std::env::set_var() }` in `ollama/src/client.rs`, as
setting environment variables in a multithreaded context is indeed
unsafe and these tests were observed to be flaky, as a result.

Though as I dug deeper into the issue, I discovered that the logic for
instantiating `OllamaClient` under test scenarios was not quite right.
In this PR, I aimed to:

- share more code between the two creation codepaths,
`try_from_oss_provider()` and `try_from_provider_with_base_url()`
- use the values from `Config` when setting up Ollama, as we have
various mechanisms for overriding config values, so we should be sure
that we are always using the ultimate `Config` for things such as the
`ModelProviderInfo` associated with the `oss` id

Once this was in place,
`OllamaClient::try_from_provider_with_base_url()` could be used in unit
tests for `OllamaClient` so it was possible to create a properly
configured client without having to set environment variables.
2025-08-05 13:55:32 -07:00
Michael Bolin 359bd892dc merge commit for archive created by Sapling 2025-08-05 13:30:32 -07:00
Michael Bolin 3779c2ddd1 fix: remove unsafe blocks and use of set_var(), as it is unsafe 2025-08-05 13:30:17 -07:00
Michael Bolin aebf4d3b73 merge commit for archive created by Sapling 2025-08-05 13:25:19 -07:00
Michael Bolin b9c7dd430e fix: remove unsafe blocks and use of set_var(), as it is unsafe 2025-08-05 13:25:05 -07:00
Michael Bolin bc511deb3f merge commit for archive created by Sapling 2025-08-05 13:21:37 -07:00
Michael Bolin 8ea22920b0 fix: remove unsafe blocks and use of set_var(), as it is unsafe 2025-08-05 13:21:19 -07:00
Michael Bolin f1d45a9315 merge commit for archive created by Sapling 2025-08-05 13:17:43 -07:00
Michael Bolin 3270011a6c fix: remove unsafe blocks and use of set_var(), as it is unsafe 2025-08-05 13:17:25 -07:00
Michael Bolin 63701e4987 Merge 51108b909b into sapling-pr-archive-bolinfest 2025-08-05 12:34:41 -07:00
Michael Bolin 51108b909b fix: remove unsafe blocks and use of set_var(), as it is unsafe 2025-08-05 12:34:26 -07:00
Michael Bolin 810e89c376 Merge 33d8732694 into sapling-pr-archive-bolinfest 2025-08-05 11:48:59 -07:00
Michael Bolin 33d8732694 chore: remove unnecessary default_ prefix 2025-08-05 11:48:41 -07:00
Michael Bolin 0c5fa271bc fix: README ToC did not match contents (#1857)
Similar to https://github.com/openai/codex/pull/1855, this got through.

Fixed by running:

```
python3 scripts/readme_toc.py --fix README.md
```
2025-08-05 11:48:28 -07:00
Michael Bolin d9ebcda578 Merge 623c6355cf into sapling-pr-archive-bolinfest 2025-08-05 11:47:32 -07:00
Michael Bolin 623c6355cf fix: README ToC did not match contents 2025-08-05 11:47:15 -07:00
Michael Bolin d29ad70f17 Merge ff719f645b into sapling-pr-archive-bolinfest 2025-08-05 11:45:02 -07:00
Michael Bolin ff719f645b chore: remove unnecessary default_ prefix 2025-08-05 11:44:30 -07:00
Michael Bolin bd24bc320e fix: clean out some ASCII (#1856)
Similar to https://github.com/openai/codex/pull/1855, this got through.

Fixed by running:

```
./scripts/asciicheck.py README.md
```
2025-08-05 11:44:04 -07:00
Michael Bolin aa5147a86a Merge 157a9d0c3e into sapling-pr-archive-bolinfest 2025-08-05 11:43:23 -07:00
Michael Bolin 157a9d0c3e fix: clean out some ASCII 2025-08-05 11:43:07 -07:00
Michael Bolin 9edd12378e Merge 1243bb03bf into sapling-pr-archive-bolinfest 2025-08-05 11:40:16 -07:00
Michael Bolin 1243bb03bf chore: remove unnecessary default_ prefix 2025-08-05 11:39:53 -07:00
Michael Bolin 9f91b3da24 fix: correct spelling error that sneaked through (#1855)
I ended up force-pushing https://github.com/openai/codex/pull/1848
because CI jobs were not being triggered after updating the PR on
GitHub, so this spelling error sneaked through.
2025-08-05 11:39:30 -07:00
Michael Bolin bc00177bcf Merge 145df4556e into sapling-pr-archive-bolinfest 2025-08-05 11:38:26 -07:00
Michael Bolin 145df4556e fix: correct spelling error that sneaked through 2025-08-05 11:38:10 -07:00
Michael Bolin 4582400739 merge commit for archive created by Sapling 2025-08-05 11:36:22 -07:00
Michael Bolin d6cfe922f2 chore: remove unnecessary default_ prefix 2025-08-05 11:36:01 -07:00
easong-openaiandMichael Bolin 9285350842 Introduce --oss flag to use gpt-oss models (#1848)
This adds support for easily running Codex backed by a local Ollama
instance running our new open source models. See
https://github.com/openai/gpt-oss for details.

If you pass in `--oss` you'll be prompted to install/launch ollama, and
it will automatically download the 20b model and attempt to use it.

We'll likely want to expand this with some options later to make the
experience smoother for users who can't run the 20b or want to run the
120b.

Co-authored-by: Michael Bolin <mbolin@openai.com>
2025-08-05 11:31:11 -07:00
Michael Bolin 5e19415a76 merge commit for archive created by Sapling 2025-08-05 11:20:26 -07:00
Michael Bolin 95abf99e71 feat: add a built-in model provider named "oss" 2025-08-05 11:19:49 -07:00
Michael Bolin 4220fce51d merge commit for archive created by Sapling 2025-08-05 02:34:32 -07:00
Michael Bolin 8e08ab7f80 feat: add a built-in model provider named "oss" 2025-08-05 02:34:12 -07:00
Michael Bolin f939d50980 merge commit for archive created by Sapling 2025-08-05 02:23:17 -07:00
Michael Bolin bc427d6f71 feat: add a built-in model provider named "oss" 2025-08-05 02:22:55 -07:00
Michael Bolin ee043a0029 Merge 505d6c22dc into sapling-pr-archive-bolinfest 2025-08-05 02:13:41 -07:00
Michael Bolin 505d6c22dc feat: add a built-in model provider named "oss" 2025-08-05 02:13:25 -07:00
easong-openaiandAhmed Ibrahim e0303dbac0 Rescue chat completion changes (#1846)
https://github.com/openai/codex/pull/1835 has some messed up history.

This adds support for streaming chat completions, which is useful for ollama. We should probably take a very skeptical eye to the code introduced in this PR.

---------

Co-authored-by: Ahmed Ibrahim <aibrahim@openai.com>
2025-08-05 08:56:13 +00:00
Dylan d31e149cb1 [prompt] Update prompt.md (#1839)
## Summary
Additional clarifications to our prompt. Still very concise, but we'll
continue to add more here.
2025-08-05 00:43:23 -07:00
Michael Bolin 136b3ee5bf chore: introduce ModelFamily abstraction (#1838)
To date, we have a number of hardcoded OpenAI model slug checks spread
throughout the codebase, which makes it hard to audit the various
special cases for each model. To mitigate this issue, this PR introduces
the idea of a `ModelFamily` that has fields to represent the existing
special cases, such as `supports_reasoning_summaries` and
`uses_local_shell_tool`.

There is a `find_family_for_model()` function that maps the raw model
slug to a `ModelFamily`. This function hardcodes all the knowledge about
the special attributes for each model. This PR then replaces the
hardcoded model name checks with checks against a `ModelFamily`.

Note `ModelFamily` is now available as `Config::model_family`. We should
ultimately remove `Config::model` in favor of
`Config::model_family::slug`.
2025-08-04 23:50:03 -07:00
Michael Bolin bf0daf6ea1 merge commit for archive created by Sapling 2025-08-04 23:41:06 -07:00