Commit Graph

8634 Commits

Author SHA1 Message Date
Wang
ac8a3155d6 feat(core): re-export InitialHistory from conversation_manager (#3270)
This commit adds a re-export for InitialHistory from the internal
conversation_manager module in codex-core's lib.rs.

The `RolloutRecorder::get_rollout_history` method (exposed via `pub use
rollout::RolloutRecorder;`, already present in lib.rs) returns an
`InitialHistory` type, which is defined in the private
conversation_manager module. Without this re-export, consumers of the
public RolloutRecorder API would not be able to directly use the return
type, as they cannot access the private module. This would result in an
inconvenient experience where the method's return value cannot be
handled without additional, non-obvious imports.

By adding `pub use conversation_manager::InitialHistory;`, we make
InitialHistory available as `codex_core::InitialHistory`, improving API
ergonomics for users of the rollout functionality while keeping the
conversation_manager module internal.

No functional changes are made; this is a pure re-export for better
usability.

Signed-off-by: M4n5ter <m4n5terrr@gmail.com>
2025-09-09 10:37:08 -07:00
Michael Bolin
ace14e8d36 feat: add ArchiveConversation to ClientRequest (#3353)
Adds support for `ArchiveConversation` in the JSON-RPC server that takes
a `(ConversationId, PathBuf)` pair and:

- verifies the `ConversationId` corresponds to the rollout id at the
`PathBuf`
- if so, invokes
`ConversationManager.remove_conversation(ConversationId)`
- if the `CodexConversation` was in memory, send `Shutdown` and wait for
`ShutdownComplete` with a timeout
- moves the `.jsonl` file to `$CODEX_HOME/archived_sessions`

---------

Co-authored-by: Gabriel Peal <gabriel@openai.com>
2025-09-09 11:39:00 -04:00
Michael Bolin
787e1f69e2 merge commit for archive created by Sapling 2025-09-09 00:28:45 -07:00
Michael Bolin
fb419e0f65 fix: LoginChatGptCompleteNotification does not need to be listed explicitly in protocol-ts 2025-09-09 00:28:39 -07:00
Michael Bolin
46554c9f5b Merge 656256706c into sapling-pr-archive-bolinfest 2025-09-09 00:25:52 -07:00
Michael Bolin
656256706c feat: add ArchiveConversation to ClientRequest 2025-09-09 00:25:08 -07:00
Michael Bolin
3249b91b6f Merge 112d4bfc00 into sapling-pr-archive-bolinfest 2025-09-09 00:24:30 -07:00
Michael Bolin
112d4bfc00 fix: LoginChatGptCompleteNotification does not need to be listed explicitly in protocol-ts 2025-09-09 00:24:24 -07:00
Michael Bolin
e79be6b07a Merge 7af0d19407 into sapling-pr-archive-bolinfest 2025-09-09 00:21:52 -07:00
Michael Bolin
7af0d19407 fix: remove unnecessary #[allow(dead_code)] annotation 2025-09-09 00:21:46 -07:00
Michael Bolin
b057fe7563 Merge af2d8e14c7 into sapling-pr-archive-bolinfest 2025-09-09 00:12:08 -07:00
Michael Bolin
af2d8e14c7 feat: add ArchiveConversation to ClientRequest 2025-09-09 00:12:02 -07:00
Michael Bolin
2a76a08a9e fix: include rollout_path in NewConversationResponse (#3352)
Adding the `rollout_path` to the `NewConversationResponse` makes it so a
client can perform subsequent operations on a `(ConversationId,
PathBuf)` pair. #3353 will introduce support for `ArchiveConversation`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/3352).
* #3353
* __->__ #3352
2025-09-09 00:11:48 -07:00
Michael Bolin
fce0e62375 Merge cd6f331264 into sapling-pr-archive-bolinfest 2025-09-09 00:11:11 -07:00
Michael Bolin
cd6f331264 feat: add ArchiveConversation to ClientRequest 2025-09-09 00:11:07 -07:00
Michael Bolin
46f3ea6ca6 merge commit for archive created by Sapling 2025-09-09 00:09:44 -07:00
Michael Bolin
b69c2875d0 feat: add ArchiveConversation to ClientRequest 2025-09-09 00:09:38 -07:00
Michael Bolin
b4755e27e3 merge commit for archive created by Sapling 2025-09-08 23:33:30 -07:00
Michael Bolin
5dd656d2e0 feat: add ArchiveConversation to ClientRequest 2025-09-08 23:31:56 -07:00
Michael Bolin
f19f1b2561 Merge 5c281e66b5 into sapling-pr-archive-bolinfest 2025-09-08 23:18:18 -07:00
Michael Bolin
5c281e66b5 fix: remove empty file: chatwidget_stream_tests.rs 2025-09-08 23:18:14 -07:00
Michael Bolin
0053a13f27 Merge 399837a740 into sapling-pr-archive-bolinfest 2025-09-08 23:16:28 -07:00
Michael Bolin
399837a740 fix: remove empty file: chatwidget_stream_tests.rs 2025-09-08 23:16:24 -07:00
Michael Bolin
c1f998eab8 Merge 190f325a5d into sapling-pr-archive-bolinfest 2025-09-08 23:14:41 -07:00
Michael Bolin
190f325a5d fix: remove empty file: chatwidget_stream_tests.rs 2025-09-08 23:14:35 -07:00
Michael Bolin
a658db70a1 merge commit for archive created by Sapling 2025-09-08 23:13:49 -07:00
Michael Bolin
a4ed054dc4 feat: add ArchiveConversation to ClientRequest 2025-09-08 23:13:43 -07:00
Michael Bolin
87ee31430f Merge cc3ab8e075 into sapling-pr-archive-bolinfest 2025-09-08 23:07:32 -07:00
Michael Bolin
cc3ab8e075 feat: add ArchiveConversation to ClientRequest 2025-09-08 23:07:26 -07:00
Michael Bolin
05601cf73c merge commit for archive created by Sapling 2025-09-08 22:29:10 -07:00
Michael Bolin
4228a129cc fix: include rollout_path in NewConversationResponse 2025-09-08 22:29:03 -07:00
Michael Bolin
66c519b3de Merge 15746d80f4 into sapling-pr-archive-bolinfest 2025-09-08 22:08:36 -07:00
Michael Bolin
15746d80f4 fix: include rollout_path in NewConversationResponse 2025-09-08 22:08:23 -07:00
Michael Bolin
16309d6b68 chore: try switching to cargo nextest to speed up CI builds (#3323)
I started looking at https://nexte.st/ because I was interested in a
test harness that lets a test dynamically declare itself "skipped,"
which would be a nice alternative to this pattern:


4c46490e53/codex-rs/core/tests/suite/cli_stream.rs (L22-L27)

ChatGPT pointed me at https://nexte.st/, which also claims to be "up to
3x as fast as cargo test." Locally, in `codex-rs`, I see

- `cargo nextest run` finishes in 19s
- `cargo test` finishes in 37s

Though looking at CI, the wins are quite as big, presumably because my
laptop has more cores than our GitHub runners (which is a separate
issue...). Comparing the [CI jobs from this
PR](https://github.com/openai/codex/actions/runs/17561325162/job/49878216246?pr=3323)
with that of a [recent open
PR](https://github.com/openai/codex/actions/runs/17561066581/job/49877342753?pr=3321):

| | `cargo test` | `cargo nextest` |
| ----------------------------------------------- | ------------ |
--------------- |
| `macos-14 - aarch64-apple-darwin` | 2m16s | 1m51s |
| `macos-14 - aarch64-apple-darwin` | 5m04s | 3m44s |
| `ubuntu-24.04 - x86_64-unknown-linux-musl` | 2m02s | 1m56s |
| `ubuntu-24.04-arm - aarch64-unknown-linux-musl` | 2m01s | 1m35s |
| `windows-latest - x86_64-pc-windows-msvc` | 3m07s | 2m53s |
| `windows-11-arm - aarch64-pc-windows-msvc` | 3m10s | 2m45s |

I thought that, to start, we would only make this change in CI before
declaring it the "official" way for the team to run the test suite.

Though unfortunately, I do not believe that `cargo nextest` _actually_
supports a dynamic skip feature, so I guess I'll have to keep looking?
Some related discussions:

- https://internals.rust-lang.org/t/pre-rfc-skippable-tests/14611
- https://internals.rust-lang.org/t/skippable-tests/21260
2025-09-08 21:39:18 -07:00
Michael Bolin
018bc3dac9 merge commit for archive created by Sapling 2025-09-08 21:23:21 -07:00
Michael Bolin
9d990a399f chore: try switching to cargo nextest 2025-09-08 21:23:05 -07:00
Michael Bolin
c73d9d03e6 merge commit for archive created by Sapling 2025-09-08 21:20:37 -07:00
Michael Bolin
3b33904f52 chore: try switching to cargo nextest 2025-09-08 21:20:31 -07:00
jif-oai
62bd0e3d9d feat: POSIX unification and snapshot sessions (#3179)
## Session snapshot
For POSIX shell, the goal is to take a snapshot of the interactive shell
environment, store it in a session file located in `.codex/` and only
source this file for every command that is run.
As a result, if a snapshot files exist, `bash -lc <CALL>` get replaced
by `bash -c <CALL>`.

This also fixes the issue that `bash -lc` does not source `.bashrc`,
resulting in missing env variables and aliases in the codex session.
## POSIX unification
Unify `bash` and `zsh` shell into a POSIX shell. The rational is that
the tool will not use any `zsh` specific capabilities.

---------

Co-authored-by: Michael Bolin <mbolin@openai.com>
2025-09-08 18:09:45 -07:00
jif-oai
a9c68ea270 feat: Run cargo shear during CI (#3338)
Run cargo shear as part of the CI to ensure no unused dependencies
2025-09-09 01:05:08 +00:00
Jeremy Rose
ac58749bd3 allow mach-lookup for com.apple.system.opendirectoryd.libinfo (#3334)
in the base sandbox policy. this is [allowed in Chrome
renderers](https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=266;drc=7afa0043cfcddb3ef9dafe5acbfc01c2f7e7df01),
so I feel it's fairly safe.
2025-09-08 16:28:52 -07:00
Robert
79cbd2ab1b Improve explanation of how the shell handles quotes in config.md (#3169)
* Clarify how the shell's handling of quotes affects the interpretation
of TOML values in `--config`/`-c`
* Provide examples of the right way to pass complex TOML values
* The previous explanation incorrectly demonstrated how to pass TOML
values to `--config`/`-c` (misunderstanding how the shell’s handling of
quotes affects things) and would result in invalid invocations of
`codex`.
2025-09-08 15:58:25 -07:00
Gabriel Peal
5eaaf307e1 Generate more typescript types and return conversation id with ConversationSummary (#3219)
This PR does multiple things that are necessary for conversation resume
to work from the extension. I wanted to make sure everything worked so
these changes wound up in one PR:
1. Generate more ts types
2. Resume rollout history files rather than create a new one every time
it is resumed so you don't see a duplicate conversation in history for
every resume. Chatted with @aibrahim-oai to verify this
3. Return conversation_id in conversation summaries
4. [Cleanup] Use serde and strong types for a lot of the rollout file
parsing
2025-09-08 17:54:47 -04:00
Justin Lebar
18330c2362 Format large numbers in a more readable way. (#2046)
- In the bottom line of the TUI, print the number of tokens to 3 sigfigs
  with an SI suffix, e.g. "1.23K".
- Elsewhere where we print a number, I figure it's worthwhile to print
  the exact number, because e.g. it's a summary of your session. Here we print
  the numbers comma-separated.
2025-09-08 21:48:48 +00:00
Michael Bolin
304800fbdf merge commit for archive created by Sapling 2025-09-08 12:07:57 -07:00
Michael Bolin
ad620d107a chore: try switching to cargo nextest 2025-09-08 12:07:51 -07:00
Michael Bolin
3489b7f435 merge commit for archive created by Sapling 2025-09-08 12:00:56 -07:00
Michael Bolin
3eed899cc0 chore: try switching to cargo nextest 2025-09-08 12:00:51 -07:00
Michael Bolin
edea375750 Merge 60c7ce4e95 into sapling-pr-archive-bolinfest 2025-09-08 11:53:55 -07:00
Michael Bolin
60c7ce4e95 chore: try switching to cargo nextest 2025-09-08 11:53:47 -07:00