Commit Graph

8634 Commits

Author SHA1 Message Date
Michael Bolin
fc1d6b1b6f feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 20:41:20 -07:00
Michael Bolin
a400649687 Merge 3a555869c1 into sapling-pr-archive-bolinfest 2025-04-25 19:51:37 -07:00
Michael Bolin
3a555869c1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:51:33 -07:00
Michael Bolin
931877fb82 merge commit for archive created by Sapling 2025-04-25 19:51:04 -07:00
Michael Bolin
ffbcccc219 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:50:58 -07:00
Michael Bolin
2e541ccd39 merge commit for archive created by Sapling 2025-04-25 19:34:27 -07:00
Michael Bolin
70097dbaa1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:34:19 -07:00
Michael Bolin
5f4d72de17 merge commit for archive created by Sapling 2025-04-25 18:04:53 -07:00
Michael Bolin
86c2498972 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 18:04:47 -07:00
Michael Bolin
6d5a10b9f4 merge commit for archive created by Sapling 2025-04-25 18:03:44 -07:00
Michael Bolin
707beb21e8 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 18:03:35 -07:00
Michael Bolin
b0ba65a936 fix: write logs to ~/.codex/log instead of /tmp (#669)
Previously, the Rust TUI was writing log files to `/tmp`, which is
world-readable and not available on Windows, so that isn't great.

This PR tries to clean things up by adding a function that provides the
path to the "Codex config dir," e.g., `~/.codex` (though I suppose we
could support `$CODEX_HOME` to override this?) and then defines other
paths in terms of the result of `codex_dir()`.

For example, `log_dir()` returns the folder where log files should be
written which is defined in terms of `codex_dir()`. I updated the TUI to
use this function. On UNIX, we even go so far as to `chmod 600` the log
file by default, though as noted in a comment, it's a bit tedious to do
the equivalent on Windows, so we just let that go for now.

This also changes the default logging level to `info` for `codex_core`
and `codex_tui` when `RUST_LOG` is not specified. I'm not really sure if
we should use a more verbose default (it may be helpful when debugging
user issues), though if so, we should probably also set up log rotation?
2025-04-25 17:37:41 -07:00
Fouad Matin
103093f793 bump(version): 0.1.2504251709 (#660)
## `0.1.2504251709`

### 🚀 Features

- Add openai model info configuration (#551)
- Added provider to run quiet mode function (#571)
- Create parent directories when creating new files (#552)
- Print bug report URL in terminal instead of opening browser (#510)
(#528)
- Add support for custom provider configuration in the user config
(#537)
- Add support for OpenAI-Organization and OpenAI-Project headers (#626)
- Add specific instructions for creating API keys in error msg (#581)
- Enhance toCodePoints to prevent potential unicode 14 errors (#615)
- More native keyboard navigation in multiline editor (#655)
- Display error on selection of invalid model (#594)

### 🪲 Bug Fixes

- Model selection (#643)
- Nits in apply patch (#640)
- Input keyboard shortcuts (#676)
- `apply_patch` unicode characters (#625)
- Don't clear turn input before retries (#611)
- More loosely match context for apply_patch (#610)
- Update bug report template - there is no --revision flag (#614)
- Remove outdated copy of text input and external editor feature (#670)
- Remove unreachable "disableResponseStorage" logic flow introduced in
#543 (#573)
- Non-openai mode - fix for gemini content: null, fix 429 to throw
before stream (#563)
- Only allow going up in history when not already in history if input is
empty (#654)
- Do not grant "node" user sudo access when using run_in_container.sh
(#627)
- Update scripts/build_container.sh to use pnpm instead of npm (#631)
- Update lint-staged config to use pnpm --filter (#582)
- Non-openai mode - don't default temp and top_p (#572)
- Fix error catching when checking for updates (#597)
- Close stdin when running an exec tool call (#636)
2025-04-25 17:15:40 -07:00
Fouad Matin
3f4762d969 fix: input keyboard shortcuts (#676)
Fixes keyboard shortcuts:
- ctrl+a/e
- opt+arrow keys
2025-04-25 16:58:09 -07:00
Michael Bolin
948a91096a Merge 0492b91d38 into sapling-pr-archive-bolinfest 2025-04-25 16:34:37 -07:00
Michael Bolin
0492b91d38 fix: use os-specific env var to locate .cargo folder 2025-04-25 16:34:29 -07:00
Michael Bolin
0705963691 Merge 532da04bb4 into sapling-pr-archive-bolinfest 2025-04-25 16:22:39 -07:00
Michael Bolin
532da04bb4 fix: write logs to ~/.codex/log instead of /tmp 2025-04-25 16:22:33 -07:00
Michael Bolin
f3ee933a74 ci: build Rust on Windows as part of CI (#665)
While we aren't ready to provide Windows binaries of Codex CLI, it seems
like a good idea to ensure we guard platform-specific code
appropriately.
2025-04-25 16:22:16 -07:00
Thibault Sottiaux
44d68f9dbf fix: remove outdated copy of text input and external editor feature (#670)
Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 16:11:16 -07:00
Misha Davidov
15bf5ca971 fix: handling weird unicode characters in apply_patch (#674)
I � unicode
2025-04-25 16:01:58 -07:00
Michael Bolin
c18f1689a9 fix: small fixes so Codex compiles on Windows (#673)
Small fixes required:

* `ExitStatusExt` differs because UNIX expects exit code to be `i32`
whereas Windows does `u32`
* Marking a file "executable only by owner" is a bit more involved on
Windows. We just do something approximate for now (and add a TODO) to
get things compiling.

I created this PR on my personal Windows machine and `cargo test` and
`cargo clippy` succeed. Once this is in, I'll rebase
https://github.com/openai/codex/pull/665 on top so Windows stays fixed!
2025-04-25 15:58:44 -07:00
Michael Bolin
1db5b3bf49 Merge 0a13bb010b into sapling-pr-archive-bolinfest 2025-04-25 14:20:39 -07:00
Michael Bolin
0a13bb010b ci: build Rust on Windows as part of CI to ensure we guard platform-specific code appropriately 2025-04-25 14:20:28 -07:00
Michael Bolin
ebd2ae4abd fix: remove dependency on expanduser crate (#667)
In putting up https://github.com/openai/codex/pull/665, I discovered
that the `expanduser` crate does not compile on Windows. Looking into
it, we do not seem to need it because we were only using it with a value
that was passed in via a command-line flag, so the shell expands `~` for
us before we see it, anyway. (I changed the type in `Cli` from `String`
to `PathBuf`, to boot.)

If we do need this sort of functionality in the future,
https://docs.rs/shellexpand/latest/shellexpand/fn.tilde.html seems
promising.
2025-04-25 14:20:21 -07:00
Michael Bolin
46458351ab Merge 9a19126a73 into sapling-pr-archive-bolinfest 2025-04-25 14:15:43 -07:00
Michael Bolin
51fabefd19 Merge a07986e518 into sapling-pr-archive-bolinfest 2025-04-25 14:11:54 -07:00
Michael Bolin
a07986e518 fix: remove dependency on expanduser crate 2025-04-25 14:11:47 -07:00
Michael Bolin
9a19126a73 fix: write logs to ~/.codex/log instead of /tmp 2025-04-25 14:06:05 -07:00
Michael Bolin
39eb4060bc Merge bd74cccddc into sapling-pr-archive-bolinfest 2025-04-25 13:51:34 -07:00
Michael Bolin
bd74cccddc ci: build Rust on Windows as part of CI to ensure we guard platform-specific code appropriately 2025-04-25 13:51:30 -07:00
Michael Bolin
bd7e04b521 Merge 8c09afb5af into sapling-pr-archive-bolinfest 2025-04-25 13:47:13 -07:00
Michael Bolin
8c09afb5af ci: build Rust on Windows as part of CI to ensure we guard platform-specific code appropriately 2025-04-25 13:47:07 -07:00
Michael Bolin
9c3ebac3b7 fix: flipped the sense of Prompt.store in #642 (#663)
I got the sense of this wrong in
https://github.com/openai/codex/pull/642. In that PR, I made
`--disable-response-storage` work, but broke the default case.

With this fix, both cases work and I think the code is a bit cleaner.
2025-04-25 13:41:17 -07:00
Michael Bolin
b39730462d merge commit for archive created by Sapling 2025-04-25 13:32:32 -07:00
Michael Bolin
7ab4366709 fix: flipped the sense of Prompt.store in #642 2025-04-25 13:32:22 -07:00
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
Tomas Cupr
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