Commit Graph
9048 Commits
Author SHA1 Message Date
Parker Thompson 7d9de34bc7 [codex-rs] Improve linux sandbox timeouts (#662)
* Fixes flaking rust unit test
* Adds explicit sandbox exec timeout handling
2025-04-25 12:56:20 -07:00
Parker Thompson 55e25abf78 [codex-rs] CI performance for rust (#639)
* Refactors the rust-ci into a matrix build
* Adds directory caching for the build artifacts
* Adds workflow dispatch for manual testing
2025-04-25 12:44:03 -07:00
Michael Bolin b323d10ea7 feat: add ZDR support to Rust implementation (#642)
This adds support for the `--disable-response-storage` flag across our
multiple Rust CLIs to support customers who have opted into Zero-Data
Retention (ZDR). The analogous changes to the TypeScript CLI were:

* https://github.com/openai/codex/pull/481
* https://github.com/openai/codex/pull/543

For a client using ZDR, `previous_response_id` will never be available,
so the `input` field of an API request must include the full transcript
of the conversation thus far. As such, this PR changes the type of
`Prompt.input` from `Vec<ResponseInputItem>` to `Vec<ResponseItem>`.

Practically speaking, `ResponseItem` was effectively a "superset" of
`ResponseInputItem` already. The main difference for us is that
`ResponseItem` includes the `FunctionCall` variant that we have to
include as part of the conversation history in the ZDR case.

Another key change in this PR is modifying `try_run_turn()` so that it
returns the `Vec<ResponseItem>` for the turn in addition to the
`Vec<ResponseInputItem>` produced by `try_run_turn()`. This is because
the caller of `run_turn()` needs to record the `Vec<ResponseItem>` when
ZDR is enabled.

To that end, this PR introduces `ZdrTranscript` (and adds
`zdr_transcript: Option<ZdrTranscript>` to `struct State` in `codex.rs`)
to take responsibility for maintaining the conversation transcript in
the ZDR case.
2025-04-25 12:08:18 -07:00
Michael Bolin dc7b83666a feat(tui-rs): add support for mousewheel scrolling (#641)
It is intuitive to try to scroll the conversation history using the
mouse in the TUI, but prior to this change, we only supported scrolling
via keyboard events.

This PR enables mouse capture upon initialization (and disables it on
exit) such that we get `ScrollUp` and `ScrollDown` events in
`codex-rs/tui/src/app.rs`. I initially mapped each event to scrolling by
one line, but that felt sluggish. I decided to introduce
`ScrollEventHelper` so we could debounce scroll events and measure the
number of scroll events in a 100ms window to determine the "magnitude"
of the scroll event. I put in a basic heuristic to start, but perhaps
someone more motivated can play with it over time.

`ScrollEventHelper` takes care of handling the atomic fields and thread
management to ensure an `AppEvent::Scroll` event is pumped back through
the event loop at the appropriate time with the accumulated delta.
2025-04-25 12:01:52 -07:00
Michael Bolin 44ea5ab564 merge commit for archive created by Sapling 2025-04-25 12:00:38 -07:00
Michael Bolin 42209b172c feat: add ZDR support to Rust implementation 2025-04-25 12:00:32 -07:00
Michael Bolin 884be27925 merge commit for archive created by Sapling 2025-04-25 11:48:30 -07:00
Michael Bolin 285c335951 feat: add ZDR support to Rust implementation 2025-04-25 11:48:21 -07:00
Michael Bolin 65c7bcce0b merge commit for archive created by Sapling 2025-04-25 11:44:35 -07:00
Michael Bolin 2e1904f308 feat: add ZDR support to Rust implementation 2025-04-25 11:44:28 -07:00
oai-ragona d7a40195e6 [codex-rs] Reliability pass on networking (#658)
We currently see a behavior that looks like this:
```
2025-04-25T16:52:24.552789Z  WARN codex_core::codex: stream disconnected - retrying turn (1/10 in 232ms)...
codex> event: BackgroundEvent { message: "stream error: stream disconnected before completion: Transport error: error decoding response body; retrying 1/10 in 232ms…" }
2025-04-25T16:52:54.789885Z  WARN codex_core::codex: stream disconnected - retrying turn (2/10 in 418ms)...
codex> event: BackgroundEvent { message: "stream error: stream disconnected before completion: Transport error: error decoding response body; retrying 2/10 in 418ms…" }
```

This PR contains a few different fixes that attempt to resolve/improve
this:
1. **Remove overall client timeout.** I think
[this](https://github.com/openai/codex/pull/658/files#diff-c39945d3c42f29b506ff54b7fa2be0795b06d7ad97f1bf33956f60e3c6f19c19L173)
is perhaps the big fix -- it looks to me like this was actually timing
out even if events were still coming through, and that was causing a
disconnect right in the middle of a healthy stream.
2. **Cap response sizes.** We were frequently sending MUCH larger
responses than the upstream typescript `codex`, and that was definitely
not helping. [Fix
here](https://github.com/openai/codex/pull/658/files#diff-d792bef59aa3ee8cb0cbad8b176dbfefe451c227ac89919da7c3e536a9d6cdc0R21-R26)
for that one.
3. **Much higher idle timeout.** Our idle timeout value was much lower
than typescript.
4. **Sub-linear backoff.** We were much too aggressively backing off,
[this](https://github.com/openai/codex/pull/658/files#diff-5d5959b95c6239e6188516da5c6b7eb78154cd9cfedfb9f753d30a7b6d6b8b06R30-R33)
makes it sub-exponential but maintains the jitter and such.

I was seeing that `stream error: stream disconnected` behavior
constantly, and anecdotally I can no longer reproduce. It feels much
snappier.
2025-04-25 11:44:22 -07:00
Michael Bolin 3e780a32db merge commit for archive created by Sapling 2025-04-25 11:07:27 -07:00
Michael Bolin b05ea21b17 feat: add ZDR support to Rust implementation 2025-04-25 11:07:21 -07:00
4760aa1eb9 perf: optimize token streaming with balanced approach (#635)
- Replace setTimeout(10ms) with queueMicrotask for immediate processing
- Add minimal 3ms setTimeout for rendering to maintain readable UX
- Reduces per-token delay while preserving streaming experience
- Add performance test to verify optimization works correctly

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 10:49:38 -07:00
Michael Bolin cced48f9e2 merge commit for archive created by Sapling 2025-04-25 10:41:33 -07:00
Michael Bolin 34c2daf1b4 feat: add ZDR support to Rust implementation 2025-04-25 10:41:27 -07:00
Thibault Sottiaux d401283a41 feat: more native keyboard navigation in multiline editor (#655)
Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 10:35:30 -07:00
Michael Bolin df9613b3d0 merge commit for archive created by Sapling 2025-04-25 10:34:36 -07:00
Michael Bolin 14ec2086aa feat: add ZDR support to Rust implementation 2025-04-25 10:34:27 -07:00
Michael Bolin c9e6848a4f merge commit for archive created by Sapling 2025-04-25 10:33:34 -07:00
Michael Bolin 6538d9c592 feat: add ZDR support to Rust implementation 2025-04-25 10:33:28 -07:00
Michael Bolin 5107a06186 merge commit for archive created by Sapling 2025-04-25 10:24:34 -07:00
Michael Bolin 79caa92217 feat: add ZDR support to Rust implementation 2025-04-25 10:24:28 -07:00
rumple 69ce06d2f8 feat: Add support for OpenAI-Organization and OpenAI-Project headers (#626)
Added support for OpenAI-Organization and OpenAI-Project headers for
OpenAI API calls.

This is for #74
2025-04-25 09:52:42 -07:00
Thibault Sottiaux 866626347b fix: only allow going up in history when not already in history if input is empty (#654)
\+ cleanup below input help to be "ctrl+c to exit | "/" to see commands
| enter to send" now that we have command autocompletion
\+ minor other drive-by code cleanups

---------

Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 09:39:24 -07:00
Pulipaka Sai Krishna 2759ff39da fix: model selection (#643)
fix: pass correct selected model in ModelOverlay

The ModelOverlay component was incorrectly passing the current model
instead of the newly selected model to its onSelect callback. This
prevented model changes from being applied properly.

The fix ensures that when a user selects a new model, the parent
component receives the correct newly selected model value, allowing
model changes to work as intended.
2025-04-25 09:38:05 -07:00
Luci 3fe7e53327 fix: nits in apply patch (#640)
## Description

Fix a nit in `apply patch`, potentially improving performance slightly.
2025-04-25 07:27:48 -07:00
LuciandThibault Sottiaux 1ef8e8afd3 docs: provider config (#653)
close: #651

Hi! @tibo-openai 👋 Could you share some great examples of
`instructions.md` files? Thanks!

---------

Co-authored-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 07:25:32 -07:00
Luci a9ecb2efce chore: upgrade prettier to v3 (#644)
## Description

This PR addresses the following improvements:

**Unify Prettier Version**: Currently, the Prettier version used in
`/package.json` and `/codex-cli/package.json` are different. In this PR,
we're updating both to use Prettier v3.

- Prettier v3 introduces improved support for JavaScript and TypeScript.
(e.g. the formatting scenario shown in the image below. This is more
aligned with the TypeScript indentation standard).

<img width="1126" alt="image"
src="https://github.com/user-attachments/assets/6e237eb8-4553-4574-b336-ed9561c55370"
/>

**Add Prettier Auto-Formatting in lint-staged**: We've added a step to
automatically run prettier --write on JavaScript and TypeScript files as
part of the lint-staged process, before the ESLint checks.

- This will help ensure that all committed code is properly formatted
according to the project's Prettier configuration.
2025-04-25 07:21:50 -07:00
Michael Bolin 7177f709b5 Merge 9717ac87c1 into sapling-pr-archive-bolinfest 2025-04-24 23:55:20 -07:00
Michael Bolin 9717ac87c1 feat: add ZDR support to Rust implementation 2025-04-24 23:54:21 -07:00
Michael Bolin 5847374630 merge commit for archive created by Sapling 2025-04-24 23:07:29 -07:00
Michael Bolin 73eb766637 feat(tui-rs): add support for mousewheel scrolling 2025-04-24 23:06:25 -07:00
Michael Bolin ea3637eac1 merge commit for archive created by Sapling 2025-04-24 22:36:17 -07:00
Michael Bolin 461ab550ce feat(tui-rs): add support for mousewheel scrolling 2025-04-24 22:36:13 -07:00
Michael Bolin 5e4164b251 merge commit for archive created by Sapling 2025-04-24 22:32:52 -07:00
Michael Bolin b90cf2a778 feat(tui-rs): add support for mousewheel scrolling 2025-04-24 22:32:47 -07:00
Michael Bolin 74aee5cdc8 Merge 006da34ada into sapling-pr-archive-bolinfest 2025-04-24 22:29:31 -07:00
Michael Bolin 006da34ada feat(tui-rs): add support for mousewheel scrolling 2025-04-24 22:29:28 -07:00
Michael Bolin abfe8c48cf Merge ea4557f963 into sapling-pr-archive-bolinfest 2025-04-24 22:23:50 -07:00
Michael Bolin ea4557f963 feat(tui-rs): add support for mousewheel scrolling 2025-04-24 22:22:32 -07:00
Michael Bolin bfe6fac463 fix: close stdin when running an exec tool call (#636)
We were already doing this in the TypeScript version, but forgot to
bring this over to Rust:


https://github.com/openai/codex/blob/c38c2a59c72504a72a537123dc4b6026875cdfac/codex-cli/src/utils/agent/sandbox/raw-exec.ts#L76-L78
2025-04-24 18:06:08 -07:00
Michael Bolin 6a9c9f4b6c fix: add RUST_BACKTRACE=full when running cargo test in CI (#638)
This should provide more information in the event of a failure.
2025-04-24 18:05:56 -07:00
Michael Bolin cc91e701a9 Merge 4db909caa7 into sapling-pr-archive-bolinfest 2025-04-24 18:03:27 -07:00
Michael Bolin 4db909caa7 fix: add RUST_BACKTRACE=full when running cargo test in CI 2025-04-24 18:03:21 -07:00
Michael Bolin 5cdcbfa9b4 fix: only run rust-ci.yml on PRs that modify files in codex-rs (#637)
The `rust-ci.yml` build appears to be a bit flaky (we're looking into
it...), so to save TypeScript contributors some noise, restrict the
`rust-ci.yml` job so that it only runs on PRs that touch files in
`codex-rs/`.
2025-04-24 17:59:35 -07:00
Michael Bolin 3b7b999a5e merge commit for archive created by Sapling 2025-04-24 17:56:29 -07:00
Michael Bolin eec2b1a3d4 fix: for now, only run rust-ci.yml on PRs that modify files in codex-rs 2025-04-24 17:56:23 -07:00
Michael Bolin bd71affbd1 Merge c9dffbaf04 into sapling-pr-archive-bolinfest 2025-04-24 17:54:48 -07:00
Michael Bolin c9dffbaf04 fix: for now, only run rust-ci.yml on PRs that modify files in codex-rs 2025-04-24 17:54:42 -07:00