Commit Graph

1377 Commits

Author SHA1 Message Date
Michael Bolin
c2924cabce Merge f6df45a9e1 into sapling-pr-archive-bolinfest 2025-05-17 11:23:52 -07:00
Michael Bolin
f6df45a9e1 chore: update install_native_deps.sh to use rust-v0.0.2505171051 2025-05-17 11:23:44 -07:00
Michael Bolin
2ae00568a0 Merge d690965316 into sapling-pr-archive-bolinfest 2025-05-17 11:05:09 -07:00
Michael Bolin
d690965316 fix: provide tolerance for apply_patch tool 2025-05-17 11:05:06 -07:00
Michael Bolin
ff72f0e8da Merge 2388a941f5 into sapling-pr-archive-bolinfest 2025-05-17 11:03:56 -07:00
Michael Bolin
2388a941f5 fix: provide tolerance for apply_patch tool 2025-05-17 11:03:30 -07:00
Michael Bolin
1c6a3f1097 fix: artifacts from previous frames were bleeding through in TUI (#989)
Prior to this PR, I would frequently see glyphs from previous frames
"bleed" through like this:


![image](https://github.com/user-attachments/assets/8784b3d7-f691-4df6-8666-34e2f134ee85)

I think this was due to two issues (now addressed in this PR):

* We were not making use of `ratatui::widgets::Clear` to clear out the
buffer before drawing into it.
* To calculate the `width` used with `wrapped_line_count_for_cell()`, we
were not accounting for the scrollbar.
* Now we calculate `effective_width` using
`inner.width.saturating_sub(1)` where the `1` is for the scrollbar.
* We compute `text_area` using `effective_with` and pass the `text_area`
to `paragraph.render()`.
* We eliminate the conditional `needs_scrollbar` check and always call
`render(Scrollbar)`

I suspect this bug was introduced in
https://github.com/openai/codex/pull/937, though I did not try to
verify: I'm just happy that it appears to be fixed!
codex-rs-5ee08335ac690a69035720a798df9865bc5a4278-1-rust-v0.0.2505171051
2025-05-17 10:51:11 -07:00
Michael Bolin
a5ec04bb6b merge commit for archive created by Sapling 2025-05-17 10:41:26 -07:00
Michael Bolin
ae59445426 fix: clear scrollable view before drawing next frame 2025-05-17 10:41:20 -07:00
Michael Bolin
01545a0284 merge commit for archive created by Sapling 2025-05-17 10:40:18 -07:00
Michael Bolin
8f34387813 fix: clear scrollable view before drawing next frame 2025-05-17 10:36:18 -07:00
Michael Bolin
be20d49247 Merge 56a06203bb into sapling-pr-archive-bolinfest 2025-05-17 09:11:05 -07:00
Michael Bolin
56a06203bb fix: clear scrollable view before drawing next frame 2025-05-17 09:10:43 -07:00
Michael Bolin
f8b6b1db81 fix: ensure the first user message always displays after the session info (#988)
Previously, if the first user message was sent with the command
invocation, e.g.:

```
$ cargo run --bin codex 'hello'
```

Then the user message was added as the first entry in the history and
then `is_first_event` would be `false` here:


031df77dfb/codex-rs/tui/src/conversation_history_widget.rs (L178-L179)

which would prevent the "welcome" message with things like the the model
version from displaying.

The fix in this PR is twofold:

* Reorganize the logic so the `ChatWidget` constructor stores
`initial_user_message` rather than sending it right away. Now inside
`handle_codex_event()`, it waits for the `SessionConfigured` event and
sends the `initial_user_message`, if it exists.
* In `conversation_history_widget.rs`, `add_session_info()` checks to
see whether a `WelcomeMessage` exists in the history when determining
the value of `has_welcome_message`. By construction, we expect that
`WelcomeMessage` is always the first message (in which case the existing
`let is_first_event = self.entries.is_empty();` logic would be sound),
but we decide to be extra defensive in case an `EventMsg::Error` is
processed before `EventMsg::SessionConfigured`.
2025-05-17 09:00:23 -07:00
Michael Bolin
f670a8267d Merge ce126481ce into sapling-pr-archive-bolinfest 2025-05-17 08:50:53 -07:00
Michael Bolin
ce126481ce fix: ensure the first user message always displays after the session info 2025-05-17 08:50:46 -07:00
Christoph K
031df77dfb Remove unnecessary console log from test (#970)
When running `npm test` on `codex-cli`, the test
`agent-cancel-prev-response.test.ts` logs a significant body of text to
console for no obvious reason.

This is not helpful, as it makes test logs messy and far longer.

This change deletes the `console.log(...)` that produces the behavior.
2025-05-16 19:48:11 -07:00
Michael Bolin
f9143d0361 fix: do not let Tab keypress flow through to composer when used to toggle focus (#977)
One line fix from Codex!
2025-05-16 19:27:49 -07:00
Fouad Matin
2880925a44 bump(version): 0.1.2505161800 (#978)
## `0.1.2505161800`

- Sign in with chatgpt credits (#974)
- Add support for OpenAI tool type, local_shell (#961)
2025-05-16 18:18:15 -07:00
Michael Bolin
5058dde1ca Merge 25d55ac285 into sapling-pr-archive-bolinfest 2025-05-16 18:17:20 -07:00
Michael Bolin
25d55ac285 fix: do not let Tab keypress flow through to composer when used to toggle focus 2025-05-16 18:17:13 -07:00
Fouad Matin
3e19e8fd59 add: sign in with chatgpt credits (#974) 2025-05-16 17:55:08 -07:00
Trevor Creech
c7312c9d52 Fix CLA link in workflow (#964)
## Summary
- fix the CLA link posted by the bot
- docs suggest using an absolute URL:
https://github.com/marketplace/actions/cla-assistant-lite
codex-rs-b5257992b06373acef8b20a4ca25ffc1b96688e2-1-rust-v0.0.2505161708
2025-05-16 17:11:57 -07:00
Michael Bolin
1dc14cefa1 fix: make codex-mini-latest the default model in the Rust TUI (#972)
It's time to make `codex-mini-latest` the new default, as this should be
an "evergreen" model pointer.

* Equivalent change in TypeScript
https://github.com/openai/codex/pull/951
* See some notes about using `codex-mini-latest` with MCP in
https://github.com/openai/codex/pull/961
2025-05-16 17:08:18 -07:00
Michael Bolin
4f313b77ec Merge 8f1aebe69c into sapling-pr-archive-bolinfest 2025-05-16 16:23:00 -07:00
Michael Bolin
8f1aebe69c fix: make codex-mini-latest the default model in the Rust TUI 2025-05-16 16:22:54 -07:00
Michael Bolin
b99c58fa5b Merge 09d3b3063d into sapling-pr-archive-bolinfest 2025-05-16 16:22:50 -07:00
Michael Bolin
09d3b3063d fix: make codex-mini-latest the default model in the Rust TUI 2025-05-16 16:22:43 -07:00
Michael Bolin
7ca84087e6 feat: make it possible to toggle mouse mode in the Rust TUI (#971)
I did a bit of research to understand why I could not use my mouse to
drag to select text to copy to the clipboard in iTerm.

Apparently https://github.com/openai/codex/pull/641 to enable mousewheel
scrolling broke this functionality. It seems that, unless we put in a
bit of effort, we can have drag-to-select or scrolling, but not both.
Though if you know the trick to hold down `Option` will dragging with
the mouse in iTerm, you can probably get by with this. (I did not know
about this option prior to researching this issue.)

Nevertheless, users may still prefer to disable mouse capture
altogether, so this PR introduces:

* the ability to set `tui.disable_mouse_capture = true` in `config.toml`
to disable mouse capture
* a new command, `/toggle-mouse-mode` to toggle mouse capture
2025-05-16 16:16:50 -07:00
Michael Bolin
83f369f8e1 merge commit for archive created by Sapling 2025-05-16 16:11:19 -07:00
Michael Bolin
80546e052e feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 16:11:13 -07:00
Michael Bolin
deb4e85006 Merge 1111e304c8 into sapling-pr-archive-bolinfest 2025-05-16 16:09:38 -07:00
Michael Bolin
1111e304c8 feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 16:09:34 -07:00
Michael Bolin
b18efeadcc Merge 628e3fbb9a into sapling-pr-archive-bolinfest 2025-05-16 16:02:58 -07:00
Michael Bolin
628e3fbb9a feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 16:02:55 -07:00
Michael Bolin
4d300d5103 Merge 04a069b938 into sapling-pr-archive-bolinfest 2025-05-16 16:01:16 -07:00
Michael Bolin
04a069b938 feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 16:01:11 -07:00
Michael Bolin
aec7895ca4 merge commit for archive created by Sapling 2025-05-16 15:58:53 -07:00
Michael Bolin
eaef3fe1ed feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 15:58:47 -07:00
Michael Bolin
2cb18c4f6c Merge 29583cfea6 into sapling-pr-archive-bolinfest 2025-05-16 15:52:10 -07:00
Michael Bolin
29583cfea6 feat: make it possible to toggle mouse mode in the Rust TUI 2025-05-16 15:52:00 -07:00
Michael Bolin
67ac8ef605 fix: use text other than 'TODO' as test example (#969)
I casually `rg TODO` to look for TODOs, so the use of TODO in a sample
string in test output was throwing things off.
2025-05-16 14:51:03 -07:00
Michael Bolin
b0e2cb8273 Merge 6195de0c5e into sapling-pr-archive-bolinfest 2025-05-16 14:45:12 -07:00
Michael Bolin
6195de0c5e fix: use text other than 'TODO' as test example 2025-05-16 14:45:03 -07:00
Michael Bolin
f48dd99f22 feat: add support for OpenAI tool type, local_shell (#961)
The new `codex-mini-latest` model expects a new tool with `{"type":
"local_shell"}`. Its contract is similar to the existing `function` tool
with `"name": "shell"`, so this takes the `local_shell` tool call into
`ExecParams` and sends it through the existing
`handle_container_exec_with_params()` code path.

This also adds the following logic when adding the default set of tools
to a request:

```rust
let default_tools = if self.model.starts_with("codex") {
    &DEFAULT_CODEX_MODEL_TOOLS
} else {
    &DEFAULT_TOOLS
};
```

That is, if the model name starts with `"codex"`, we add `{"type":
"local_shell"}` to the list of tools; otherwise, we add the
aforementioned `shell` tool.

To test this, I ran the TUI with `-m codex-mini-latest` and verified
that it used the `local_shell` tool. Though I also had some entries in
`[mcp_servers]` in my personal `config.toml`. The `codex-mini-latest`
model seemed eager to try the tools from the MCP servers first, so I
have personally commented them out for now, so keep an eye out if you're
testing `codex-mini-latest`!

Perhaps we should include more details with `{"type": "local_shell"}` or
update the following:


fd0b1b0208/codex-rs/core/prompt.md

For reference, the corresponding change in the TypeScript CLI is
https://github.com/openai/codex/pull/951.
2025-05-16 14:38:08 -07:00
Michael Bolin
f7e0c51a20 Merge 2040d45947 into sapling-pr-archive-bolinfest 2025-05-16 14:18:26 -07:00
Michael Bolin
2040d45947 feat: add support for OpenAI tool type, local_shell 2025-05-16 14:18:19 -07:00
Michael Bolin
dfd54e1433 chore: refactor handle_function_call() into smaller functions (#965)
Overall, `codex.rs` is still far too large, but at least there's less
indenting now that things have been moved into smaller functions.

This will also make it easier to introduce the `local_shell` tool in
https://github.com/openai/codex/pull/961.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/965).
* #961
* __->__ #965
2025-05-16 14:17:10 -07:00
Michael Bolin
6cf503fefb Merge 0698fb23d3 into sapling-pr-archive-bolinfest 2025-05-16 14:08:44 -07:00
Michael Bolin
0698fb23d3 feat: add support for OpenAI tool type, local_shell 2025-05-16 14:08:38 -07:00