Commit Graph

2955 Commits

Author SHA1 Message Date
Michael Bolin
0abd42df53 Merge eb6595ac20 into sapling-pr-archive-bolinfest 2025-08-15 13:59:39 -07:00
Michael Bolin
eb6595ac20 remove mcp-server/src/mcp_protocol.rs and the code that depends on it 2025-08-15 13:59:19 -07:00
Michael Bolin
57de0099bc Merge 8b1b3f1356 into sapling-pr-archive-bolinfest 2025-08-15 13:55:09 -07:00
Michael Bolin
8b1b3f1356 remove mcp-server/src/mcp_protocol.rs and the code that depends on it 2025-08-15 13:55:03 -07:00
Jeremy Rose
1ad8ae2579 color the status letter in apply patch summary (#2337)
<img width="440" height="77" alt="Screenshot 2025-08-14 at 8 30 30 PM"
src="https://github.com/user-attachments/assets/c6169a3a-2e98-4ace-b7ee-918cf4368b7a"
/>
2025-08-15 20:25:48 +00:00
pakrym-oai
c1156a878b Remove duplicated "Successfully logged in message" (#2357) 2025-08-15 13:01:27 -07:00
Kazuhiro Sera
dcfdd2faf5 Fix #2296 Add "minimal" reasoning effort for GPT 5 models (#2326)
This pull request resolves #2296; I've confirmed if it works by:

1. Add settings to ~/.codex/config.toml:
```toml
model_reasoning_effort = "minimal"
```

2. Run the CLI:
```
cd codex-rs
cargo build && RUST_LOG=trace cargo run --bin codex
/status
tail -f ~/.codex/log/codex-tui.log
```

Co-authored-by: pakrym-oai <pakrym@openai.com>
2025-08-15 12:59:52 -07:00
Michael Bolin
d262244725 fix: introduce codex-protocol crate (#2355) 2025-08-15 12:44:40 -07:00
Michael Bolin
54c598f8fe merge commit for archive created by Sapling 2025-08-15 10:56:45 -07:00
Michael Bolin
730f4be313 fix: introduce codex-protocol crate 2025-08-15 10:56:39 -07:00
Jeremy Rose
7c26c8e091 tui: skip identical consecutive entries in local composer history (#2352)
This PR avoids inserting duplicate consecutive messages into the Chat
Composer's local history.
2025-08-15 10:55:44 -07:00
Michael Bolin
3faf6a4c6a merge commit for archive created by Sapling 2025-08-15 10:54:32 -07:00
Michael Bolin
0b850fa1f6 fix: introduce codex-protocol crate 2025-08-15 10:54:26 -07:00
Michael Bolin
c7026731d2 merge commit for archive created by Sapling 2025-08-15 10:51:57 -07:00
Michael Bolin
9279b9cc98 fix: introduce codex-protocol crate 2025-08-15 10:51:02 -07:00
Michael Bolin
eda50d8372 feat: introduce ClientRequest::SendUserTurn (#2345)
This adds a new request type, `SendUserTurn`, that makes it possible to
submit a `Op::UserTurn` operation (introduced in #2329) to a
conversation. This PR also adds a new integration test that verifies
that changing from `AskForApproval::UnlessTrusted` to
`AskForApproval::Never` mid-conversation ensures that an elicitation is
no longer sent for running `python3 -c print(42)`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2345).
* __->__ #2345
* #2329
* #2343
* #2340
* #2338
2025-08-15 10:05:58 -07:00
Michael Bolin
17aa394ae7 feat: introduce Op:UserTurn (#2329)
This introduces `Op::UserTurn`, which makes it possible to override many
of the fields that were set when the `Session` was originally created
when creating a new conversation turn. This is one way we could support
changing things like `model` or `cwd` in the middle of the conversation,
though we may want to consider making each field optional, or
alternatively having a separate `Op` that mutates the `TurnContext`
associated with a `submission_loop()`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2329).
* #2345
* __->__ #2329
* #2343
* #2340
* #2338
2025-08-15 09:56:05 -07:00
Michael Bolin
b99d9a7096 merge commit for archive created by Sapling 2025-08-15 09:40:20 -07:00
Michael Bolin
971fdee6ed feat: introduce ClientRequest::SendUserTurn 2025-08-15 09:40:09 -07:00
Michael Bolin
747be8b5c3 feat: introduce Op:UserTurn 2025-08-15 09:40:09 -07:00
Michael Bolin
13ed67cfc1 feat: introduce TurnContext (#2343)
This PR introduces `TurnContext`, which is designed to hold a set of
fields that should be constant for a turn of a conversation. Note that
the fields of `TurnContext` were previously governed by `Session`.

Ultimately, we want to enable users to change these values between turns
(changing model, approval policy, etc.), though in the current
implementation, the `TurnContext` is constant for the entire
conversation.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2345).
* #2345
* #2329
* __->__ #2343
* #2340
* #2338
2025-08-15 09:40:02 -07:00
Jeremy Rose
45d6c74682 tui: align diff display by always showing sign char and keeping fixed gutter (#2353)
diff lines without a sign char were misaligned.
2025-08-15 09:32:45 -07:00
Michael Bolin
d3a6f30510 merge commit for archive created by Sapling 2025-08-15 09:31:09 -07:00
Michael Bolin
5510912158 feat: introduce TurnContext 2025-08-15 09:29:20 -07:00
Michael Bolin
fc979de6cd Merge fb653dc147 into sapling-pr-archive-bolinfest 2025-08-15 09:20:58 -07:00
Michael Bolin
fb653dc147 feat: introduce ClientRequest::SendUserTurn 2025-08-15 09:20:25 -07:00
Michael Bolin
ed1d34542b feat: introduce Op:UserTurn 2025-08-15 09:20:25 -07:00
Michael Bolin
c8ee33807c feat: introduce TurnContext 2025-08-15 09:20:25 -07:00
Michael Bolin
265fd89e31 fix: try to fix flakiness in test_shell_command_approval_triggers_elicitation (#2344)
I still see flakiness in
`test_shell_command_approval_triggers_elicitation()` on occasion where
`MockServer` claims it has not received all of its expected requests.

I recently introduced a similar type of test in #2264,
`test_codex_jsonrpc_conversation_flow()`, which I have not seen flake
(yet!), so this PR pulls over two things I did in that test:

- increased `worker_threads` from `2` to `4`
- added an assertion to make sure the `task_complete` notification is
received

Honestly, I'm still not sure why `MockServer` claims it sometimes does
not receive all its expected requests given that we assert that the
final `JSONRPCResponse` is read on the stream, but let's give this a
shot.

Assuming this fixes things, my hypothesis is that the increase in
`worker_threads` helps because perhaps there are async tasks in
`MockServer` that do not reliably complete fully when there are not
enough threads available? If that is correct, it seems like the test
would still be flaky, though perhaps with lower frequency?
2025-08-15 09:17:20 -07:00
Michael Bolin
6730592433 fix: introduce MutexExt::lock_unchecked() so we stop ignoring unwrap() throughout codex.rs (#2340)
This way we are sure a dangerous `unwrap()` does not sneak in!

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2340).
* #2345
* #2329
* #2343
* __->__ #2340
* #2338
2025-08-15 09:14:44 -07:00
Michael Bolin
26c8373821 fix: tighten up checks against writable folders for SandboxPolicy (#2338)
I was looking at the implementation of `Session::get_writable_roots()`,
which did not seem right, as it was a copy of writable roots, which is
not guaranteed to be in sync with the `sandbox_policy` field.

I looked at who was calling `get_writable_roots()` and its only call
site was `apply_patch()` in `codex-rs/core/src/apply_patch.rs`, which
took the roots and forwarded them to `assess_patch_safety()` in
`safety.rs`. I updated `assess_patch_safety()` to take `sandbox_policy:
&SandboxPolicy` instead of `writable_roots: &[PathBuf]` (and replaced
`Session::get_writable_roots()` with `Session::get_sandbox_policy()`).

Within `safety.rs`, it was fairly easy to update
`is_write_patch_constrained_to_writable_paths()` to work with
`SandboxPolicy`, and in particular, it is far more accurate because, for
better or worse, `SandboxPolicy::get_writable_roots_with_cwd()` _returns
an empty vec_ for `SandboxPolicy::DangerFullAccess`, suggesting that
_nothing_ is writable when in reality _everything_ is writable. With
this PR, `is_write_patch_constrained_to_writable_paths()` now does the
right thing for each variant of `SandboxPolicy`.

I thought this would be the end of the story, but it turned out that
`test_writable_roots_constraint()` in `safety.rs` needed to be updated,
as well. In particular, the test was writing to
`std::env::current_dir()` instead of a `TempDir`, which I suspect was a
holdover from earlier when `SandboxPolicy::WorkspaceWrite` would always
make `TMPDIR` writable on macOS, which made it hard to write tests to
verify `SandboxPolicy` in `TMPDIR`. Fortunately, we now have
`exclude_tmpdir_env_var` as an option on
`SandboxPolicy::WorkspaceWrite`, so I was able to update the test to
preserve the existing behavior, but to no longer write to
`std::env::current_dir()`.







---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2338).
* #2345
* #2329
* #2343
* #2340
* __->__ #2338
2025-08-15 09:06:15 -07:00
Dylan
6df8e35314 [tools] Add apply_patch tool (#2303)
## Summary
We've been seeing a number of issues and reports with our synthetic
`apply_patch` tool, e.g. #802. Let's make this a real tool - in my
anecdotal testing, it's critical for GPT-OSS models, but I'd like to
make it the standard across GPT-5 and codex models as well.

## Testing
- [x] Tested locally
- [x] Integration test
2025-08-15 11:55:53 -04:00
Michael Bolin
660d8759e2 Merge 7a156e2546 into sapling-pr-archive-bolinfest 2025-08-14 23:48:10 -07:00
Michael Bolin
7a156e2546 feat: introduce ClientRequest::SendUserTurn 2025-08-14 23:47:42 -07:00
Michael Bolin
4dd2f10051 Merge 4eda51b7a0 into sapling-pr-archive-bolinfest 2025-08-14 23:38:38 -07:00
Michael Bolin
4eda51b7a0 feat: introduce Op:UserTurn 2025-08-14 23:36:56 -07:00
Michael Bolin
59d76785d5 merge commit for archive created by Sapling 2025-08-14 23:21:13 -07:00
Michael Bolin
184741500b fix: try to fix flakiness in test_shell_command_approval_triggers_elicitation 2025-08-14 23:21:07 -07:00
Michael Bolin
24a994c160 Merge 6d92c0c0de into sapling-pr-archive-bolinfest 2025-08-14 23:10:18 -07:00
Michael Bolin
6d92c0c0de fix: try to fix flakiness in test_shell_command_approval_triggers_elicitation 2025-08-14 23:10:07 -07:00
Michael Bolin
cf3d2f81d4 merge commit for archive created by Sapling 2025-08-14 22:41:19 -07:00
Michael Bolin
39a24ff3a2 feat: introduce TurnContext 2025-08-14 22:41:02 -07:00
Michael Bolin
b4c9654c5c Merge 3ae2cdaa0c into sapling-pr-archive-bolinfest 2025-08-14 22:31:09 -07:00
Michael Bolin
3ae2cdaa0c feat: introduce TurnContext 2025-08-14 22:27:49 -07:00
Jeremy Rose
917e29803b tui: include optional full command line in history display (#2334)
Add env var to show the raw, unparsed command line under parsed
commands. When we have transcript mode we should show the full command
there, but this is useful for debugging.
2025-08-14 22:06:42 -07:00
Michael Bolin
acf0223a12 merge commit for archive created by Sapling 2025-08-14 21:53:09 -07:00
Michael Bolin
be0a82e155 fix: introduce MutexExt::lock_unchecked() so we stop ignoring unwrap() throughout codex.rs 2025-08-14 21:53:01 -07:00
Michael Bolin
6761feef07 merge commit for archive created by Sapling 2025-08-14 21:51:13 -07:00
Michael Bolin
0376c90ac2 fix: introduce MutexExt::lock_unchecked() so we stop ignoring unwrap() throughout codex.rs 2025-08-14 21:49:58 -07:00
Michael Bolin
f76b7cfa00 Merge d12b99159b into sapling-pr-archive-bolinfest 2025-08-14 21:43:39 -07:00