Commit Graph
8422 Commits
Author SHA1 Message Date
hanson-openai 7edfbae062 fix: diff command for filenames with special characters (#954)
## Summary
- fix quoting issues in `/diff` to correctly handle files with special
characters
- add regression test for `getGitDiff` when filenames contain `$`
- relax timeout in raw-exec-process-group test

Fixes https://github.com/openai/codex/issues/943

## Testing
- `pnpm test`
2025-05-16 09:10:44 -07:00
Fouad Matin 316289d01d bump(version): 0.1.2505160811 codex-mini-latest (#953)
## `0.1.2505160811`

- `codex-mini-latest` (#951)
2025-05-16 08:18:20 -07:00
Michael Bolin 30cbfdfa87 chore: update exec crate to use std::time instead of chrono (#952)
When I originally wrote `elapsed.rs`, I realized we were using both
`std::time` and `chrono` with no real benefit of having both. We should
try to keep the `exec` subcommand trim (as it also buildable as a
standalone executable), so this helps tighten things up.
2025-05-16 08:14:50 -07:00
Fouad MatinandTrevor Creech 070499f534 add: codex-mini-latest (#951)
💽

---------

Co-authored-by: Trevor Creech <tcreech@openai.com>
2025-05-16 08:04:00 -07:00
Michael Bolin ab7ccfbfd6 Merge 8a327a7283 into sapling-pr-archive-bolinfest 2025-05-16 08:00:06 -07:00
Michael Bolin 8a327a7283 chore: update exec crate to use std::time instead of chrono 2025-05-16 07:55:33 -07:00
Michael Bolin ce2ecbe72f feat: record messages from user in ~/.codex/history.jsonl (#939)
This is a large change to support a "history" feature like you would
expect in a shell like Bash.

History events are recorded in `$CODEX_HOME/history.jsonl`. Because it
is a JSONL file, it is straightforward to append new entries (as opposed
to the TypeScript file that uses `$CODEX_HOME/history.json`, so to be
valid JSON, each new entry entails rewriting the entire file). Because
it is possible for there to be multiple instances of Codex CLI writing
to `history.jsonl` at once, we use advisory file locking when working
with `history.jsonl` in `codex-rs/core/src/message_history.rs`.

Because we believe history is a sufficiently useful feature, we enable
it by default. Though to provide some safety, we set the file
permissions of `history.jsonl` to be `o600` so that other users on the
system cannot read the user's history. We do not yet support a default
list of `SENSITIVE_PATTERNS` as the TypeScript CLI does:


https://github.com/openai/codex/blob/3fdf9df1335ac9501e3fb0e61715359145711e8b/codex-cli/src/utils/storage/command-history.ts#L10-L17

We are going to take a more conservative approach to this list in the
Rust CLI. For example, while `/\b[A-Za-z0-9-_]{20,}\b/` might exclude
sensitive information like API tokens, it would also exclude valuable
information such as references to Git commits.

As noted in the updated documentation, users can opt-out of history by
adding the following to `config.toml`:

```toml
[history]
persistence = "none" 
```

Because `history.jsonl` could, in theory, be quite large, we take a[n
arguably overly pedantic] approach in reading history entries into
memory. Specifically, we start by telling the client the current number
of entries in the history file (`history_entry_count`) as well as the
inode (`history_log_id`) of `history.jsonl` (see the new fields on
`SessionConfiguredEvent`).

The client is responsible for keeping new entries in memory to create a
"local history," but if the user hits up enough times to go "past" the
end of local history, then the client should use the new
`GetHistoryEntryRequest` in the protocol to fetch older entries.
Specifically, it should pass the `history_log_id` it was given
originally and work backwards from `history_entry_count`. (It should
really fetch history in batches rather than one-at-a-time, but that is
something we can improve upon in subsequent PRs.)

The motivation behind this crazy scheme is that it is designed to defend
against:

* The `history.jsonl` being truncated during the session such that the
index into the history is no longer consistent with what had been read
up to that point. We do not yet have logic to enforce a `max_bytes` for
`history.jsonl`, but once we do, we will aspire to implement it in a way
that should result in a new inode for the file on most systems.
* New items from concurrent Codex CLI sessions amending to the history.
Because, in absence of truncation, `history.jsonl` is an append-only
log, so long as the client reads backwards from `history_entry_count`,
it should always get a consistent view of history. (That said, it will
not be able to read _new_ commands from concurrent sessions, but perhaps
we will introduce a `/` command to reload latest history or something
down the road.)

Admittedly, my testing of this feature thus far has been fairly light. I
expect we will find bugs and introduce enhancements/fixes going forward.
codex-rs-8d6a8b308e7457d432564083bb2f577cd39e132b-1-rust-v0.0.2505151627
2025-05-15 16:26:23 -07:00
Michael Bolin 11c3ce7a72 merge commit for archive created by Sapling 2025-05-15 16:18:40 -07:00
Michael Bolin 7b8f239dc1 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 16:18:34 -07:00
Michael Bolin 38ed1bd2c9 merge commit for archive created by Sapling 2025-05-15 16:02:25 -07:00
Michael Bolin e67ff236a4 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 16:01:13 -07:00
Michael Bolin f298f5fd3b merge commit for archive created by Sapling 2025-05-15 15:41:54 -07:00
Michael Bolin 4b6d0a627b feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 15:41:48 -07:00
Michael Bolin cfde8d25f8 Merge ffc1432f8a into sapling-pr-archive-bolinfest 2025-05-15 15:24:12 -07:00
Michael Bolin ffc1432f8a feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 15:24:09 -07:00
Michael Bolin 4ebe3a21d0 merge commit for archive created by Sapling 2025-05-15 15:19:28 -07:00
Michael Bolin 19fa6a552b feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 15:19:18 -07:00
Michael Bolin d10106d9cc merge commit for archive created by Sapling 2025-05-15 14:54:48 -07:00
Michael Bolin aca377958a feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 14:54:15 -07:00
Michael Bolin 3fdf9df133 chore: introduce AppEventSender to help fix clippy warnings and update to Rust 1.87 (#948)
Moving to Rust 1.87 introduced a clippy warning that
`SendError<AppEvent>` was too large.

In practice, the only thing we ever did when we got this error was log
it (if the mspc channel is closed, then the app is likely shutting down
or something, so there's not much to do...), so this finally motivated
me to introduce `AppEventSender`, which wraps
`std::sync::mpsc::Sender<AppEvent>` with a `send()` method that invokes
`send()` on the underlying `Sender` and logs an `Err` if it gets one.

This greatly simplifies the code, as many functions that previously
returned `Result<(), SendError<AppEvent>>` now return `()`, so we don't
have to propagate an `Err` all over the place that we don't really
handle, anyway.

This also makes it so we can upgrade to Rust 1.87 in CI.
2025-05-15 14:50:30 -07:00
Michael Bolin 2f26a4541b merge commit for archive created by Sapling 2025-05-15 14:41:03 -07:00
Michael Bolin ffb04a92c9 chore: introduce AppEventSender to help fix clippy warnings and update to Rust 1.87 2025-05-15 14:40:39 -07:00
Michael Bolin 8d4fa1cd45 Merge 910e8a5d85 into sapling-pr-archive-bolinfest 2025-05-15 14:07:42 -07:00
Michael Bolin 910e8a5d85 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 14:07:30 -07:00
Michael Bolin ec5e82b77c chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 (#947)
Previously, our GitHub actions specified the Rust toolchain as
`dtolnay/rust-toolchain@stable`, which meant the version could change
out from under us. In this case, the move from 1.86 to 1.87 introduced
new clippy warnings, causing build failures.

Because it will take a little time to fix all the new clippy warnings,
this PR pins things to 1.86 for now to unbreak the build.

It also replaces `io::Error::new(io::ErrorKind::Other)` with
`io::Error::other()` in preparation for 1.87.
2025-05-15 14:07:16 -07:00
Michael Bolin a7ce2e06ef Merge 581c5bfcb3 into sapling-pr-archive-bolinfest 2025-05-15 14:03:56 -07:00
Michael Bolin 581c5bfcb3 chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 2025-05-15 14:03:52 -07:00
Michael Bolin 77d0ab8357 merge commit for archive created by Sapling 2025-05-15 14:00:42 -07:00
Michael Bolin fab2b94323 chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 2025-05-15 14:00:35 -07:00
Michael Bolin c993940ec0 Merge fc4434a92d into sapling-pr-archive-bolinfest 2025-05-15 13:56:41 -07:00
Michael Bolin fc4434a92d chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 2025-05-15 13:56:37 -07:00
Michael Bolin 37f89ba5cf Merge 22037acecd into sapling-pr-archive-bolinfest 2025-05-15 13:56:32 -07:00
Michael Bolin 22037acecd chore: pin Rust version to 1.86 and use io::Error::other to prepare for 1.87 2025-05-15 13:56:21 -07:00
Michael Bolin 19879c0f5f merge commit for archive created by Sapling 2025-05-15 13:37:33 -07:00
Michael Bolin 42a1ddd6d2 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 13:37:27 -07:00
Michael Bolin ab045bf50d merge commit for archive created by Sapling 2025-05-15 13:31:13 -07:00
Michael Bolin 2a3a06efa2 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 13:31:07 -07:00
Michael Bolin 5828739c27 merge commit for archive created by Sapling 2025-05-15 12:32:59 -07:00
Michael Bolin 970e2cba4d feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 12:32:41 -07:00
Michael Bolin 5d3aef3799 Merge 8b5de5a4d6 into sapling-pr-archive-bolinfest 2025-05-15 09:00:50 -07:00
Michael Bolin 8b5de5a4d6 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 09:00:47 -07:00
Michael Bolin b47d24157c merge commit for archive created by Sapling 2025-05-15 08:59:48 -07:00
Michael Bolin d7aa41a47e feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 08:59:44 -07:00
Michael Bolin 910c594882 merge commit for archive created by Sapling 2025-05-15 08:57:18 -07:00
Michael Bolin 558eb03476 feat: record messages from user in ~/.codex/history.jsonl 2025-05-15 08:57:12 -07:00
Michael Bolin 5fc9fc3e3e chore: expose codex_home via Config (#941) 2025-05-15 00:30:13 -07:00
Michael Bolin 96f8c9c052 Merge 1226998d2b into sapling-pr-archive-bolinfest 2025-05-14 23:59:37 -07:00
Michael Bolin 1226998d2b chore: expose codex_home via Config 2025-05-14 23:59:33 -07:00
Michael Bolin 653177c618 Merge 401af38955 into sapling-pr-archive-bolinfest 2025-05-14 23:58:14 -07:00
Michael Bolin 401af38955 chore: expose codex_home via Config 2025-05-14 23:58:10 -07:00