Commit Graph
1057 Commits
Author SHA1 Message Date
Michael Bolin 2b599d59f0 Merge cfc87f9345 into sapling-pr-archive-bolinfest 2025-05-12 18:06:51 -07:00
Michael Bolin cfc87f9345 fix: always load version from package.json at runtime 2025-05-12 18:06:46 -07:00
Michael Bolin 48ba3e7ef8 Merge 33ddfabd1f into sapling-pr-archive-bolinfest 2025-05-12 18:04:38 -07:00
Michael Bolin 33ddfabd1f fix: always load version from package.json at runtime 2025-05-12 18:04:30 -07:00
Michael Bolin 61b881d4e5 fix: agent instructions were not being included when ~/.codex/instructions.md was empty (#908)
I had seen issues where `codex-rs` would not always write files without
me pressuring it to do so, and between that and the report of
https://github.com/openai/codex/issues/900, I decided to look into this
further. I found two serious issues with agent instructions:

(1) We were only sending agent instructions on the first turn, but
looking at the TypeScript code, we should be sending them on every turn.

(2) There was a serious issue where the agent instructions were
frequently lost:

* The TypeScript CLI appears to keep writing `~/.codex/instructions.md`:
https://github.com/openai/codex/blob/55142e3e6caddd1e613b71bcb89385ce5cc708bf/codex-cli/src/utils/config.ts#L586
* If `instructions.md` is present, the Rust CLI uses the contents of it
INSTEAD OF the default prompt, even if `instructions.md` is empty:
https://github.com/openai/codex/blob/55142e3e6caddd1e613b71bcb89385ce5cc708bf/codex-rs/core/src/config.rs#L202-L203

The combination of these two things means that I have been using
`codex-rs` without these key instructions:
https://github.com/openai/codex/blob/main/codex-rs/core/prompt.md

Looking at the TypeScript code, it appears we should be concatenating
these three items every time (if they exist):

* `prompt.md`
* `~/.codex/instructions.md`
* nearest `AGENTS.md`

This PR fixes things so that:

* `Config.instructions` is `None` if `instructions.md` is empty
* `Payload.instructions` is now `&'a str` instead of `Option<&'a
String>` because we should always have _something_ to send
* `Prompt` now has a `get_full_instructions()` helper that returns a
`Cow<str>` that will always include the agent instructions first.
codex-rs-94c47d69a3f92257e7f9717a2044bd55786eb999-1-rust-v0.0.2505121726
2025-05-12 17:24:44 -07:00
Michael Bolin 0882f3e003 Merge d1a917ce5f into sapling-pr-archive-bolinfest 2025-05-12 17:16:07 -07:00
Michael Bolin d1a917ce5f fix: agent instructions were not being included when ~/.codex/instructions.md was empty 2025-05-12 17:16:04 -07:00
Michael Bolin 8776ce2cc3 merge commit for archive created by Sapling 2025-05-12 17:15:26 -07:00
Michael Bolin cec83f5a1a fix: agent instructions were not being included when ~/.codex/instructions.md was empty 2025-05-12 17:15:14 -07:00
Michael Bolin 1744b21dea Merge 081f8eb7e8 into sapling-pr-archive-bolinfest 2025-05-12 17:10:42 -07:00
Michael Bolin 081f8eb7e8 fix: agent instructions were not being included when ~/.codex/instructions.md was empty 2025-05-12 17:10:35 -07:00
Michael Bolin 55142e3e6c fix: use "thinking" instead of "codex reasoning" as the label for reasoning events in the TUI (#905) codex-rs-9949f6404378db6f54a01bcadb1956e0535d4921-1-rust-v0.0.2505121520 2025-05-12 15:19:45 -07:00
Michael Bolin 115fb0b95d fix: navigate initialization phase before tools/list request in MCP client (#904)
Apparently the MCP server implemented in JavaScript did not require the
`initialize` handshake before responding to tool list/call, so I missed
this.
2025-05-12 15:15:26 -07:00
Michael Bolin 5c19e17fce Merge d64cbbf167 into sapling-pr-archive-bolinfest 2025-05-12 15:14:17 -07:00
Michael Bolin d64cbbf167 fix: use "thinking" instead of "codex reasoning" as the label for reasoning events in the TUI 2025-05-12 15:14:11 -07:00
Michael Bolin 8949fadf85 merge commit for archive created by Sapling 2025-05-12 15:10:35 -07:00
Michael Bolin 69edf359cb fix: navigate initialization phase before tools/list request in MCP client 2025-05-12 15:09:29 -07:00
Michael Bolin 89d96067e9 Merge 8a6cf1a8f0 into sapling-pr-archive-bolinfest 2025-05-12 14:43:10 -07:00
Michael Bolin 8a6cf1a8f0 fix: navigate initialization phase before tools/list request in MCP client 2025-05-12 14:43:01 -07:00
Avi Rosenberg ab4cb94227 fix: Normalize paths in resolvePathAgainstWorkdir to prevent path traversal vulnerability (#895)
This PR fixes a potential path traversal vulnerability by ensuring all
paths are properly normalized in the `resolvePathAgainstWorkdir`
function.

## Changes
- Added path normalization for both absolute and relative paths
- Ensures normalized paths are used in all subsequent operations
- Prevents potential path traversal attacks through non-normalized paths

This minimal change addresses the security concern without adding
unnecessary complexity, while maintaining compatibility with existing
code.
2025-05-12 13:44:00 -07:00
Michael Bolin 73fe1381aa chore: introduce new --native flag to Node module release process (#844)
This PR introduces an optional build flag, `--native`, that will build a
version of the Codex npm module that:

- Includes both the Node.js and native Rust versions (for Mac and Linux)
- Will run the native version if `CODEX_RUST=1` is set
- Runs the TypeScript version otherwise

Note this PR also updates the workflow URL to
https://github.com/openai/codex/actions/runs/14872557396, as that is a
build from today that includes everything up through
https://github.com/openai/codex/pull/843.

Test Plan:

In `~/code/codex/codex-cli`, I ran:

```
pnpm stage-release --native
```

The end of the output was:

```
Staged version 0.1.2505121317 for release in /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN
Test Node:
    node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help
Test Rust:
    CODEX_RUST=1 node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help
Next:  cd "/var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN" && npm publish --tag native
```

I verified that running each of these commands ran the expected version
of Codex.

While here, I also added `bin` to the `files` list in `package.json`,
which should have been done as part of
https://github.com/openai/codex/pull/757, as that added new entries to
`bin` that were matched by `.gitignore` but should have been included in
a release.
2025-05-12 13:38:10 -07:00
Michael Bolin 2da72e5341 merge commit for archive created by Sapling 2025-05-12 13:35:55 -07:00
Michael Bolin 2893055403 chore: introduce new --native flag to Node module release process 2025-05-12 13:35:50 -07:00
Michael Bolin 9ca6ed2db6 Merge e656347993 into sapling-pr-archive-bolinfest 2025-05-12 13:32:49 -07:00
Michael Bolin e656347993 chore: introduce new --native flag to Node module release process 2025-05-12 13:32:45 -07:00
Michael Bolin 0f8b101898 merge commit for archive created by Sapling 2025-05-12 13:30:39 -07:00
Michael Bolin c428265b0f chore: introduce new --native flag to Node module release process 2025-05-12 13:30:34 -07:00
Michael Bolin 993eb938b5 Merge 7c8f0ffc89 into sapling-pr-archive-bolinfest 2025-05-12 13:18:06 -07:00
Michael Bolin 7c8f0ffc89 chore: introduce new --native flag to Node module release process 2025-05-12 13:18:02 -07:00
Michael Bolin ad60a59e84 Merge 99f1cc110b into sapling-pr-archive-bolinfest 2025-05-12 13:16:29 -07:00
Michael Bolin 99f1cc110b chore: introduce new --native flag to Node module release process 2025-05-12 13:16:25 -07:00
jcoens-openai f3bd143867 Disallow expect via lints (#865)
Adds `expect()` as a denied lint. Same deal applies with `unwrap()`
where we now need to put `#[expect(...` on ones that we legit want. Took
care to enable `expect()` in test contexts.

# Tests

```
cargo fmt
cargo clippy --all-features --all-targets --no-deps -- -D warnings
cargo test
```
2025-05-12 08:45:46 -07:00
Michael Bolin a1f51bf91b fix: fix border style for BottomPane (#893)
This PR fixes things so that:

* when the `BottomPane` is in the `StatusIndicator` state, the border
should be dim
* when the `BottomPane` does not have input focus, the border should be
dim

To make it easier to enforce this invariant, this PR introduces
`BottomPane::set_state()` that will:

* update `self.state`
* call `update_border_for_input_focus()`
* request a repaint

This should make it easier to enforce other updates for state changes
going forward.
2025-05-10 23:34:13 -07:00
Michael Bolin 50d87d346d Merge dea09c6f33 into sapling-pr-archive-bolinfest 2025-05-10 23:29:18 -07:00
Michael Bolin dea09c6f33 fix: fix border style for textarea 2025-05-10 23:28:21 -07:00
Michael Bolin b4785b5f88 feat: include "reasoning" messages in Rust TUI (#892)
As shown in the screenshot, we now include reasoning messages from the
model in the TUI under the heading "codex reasoning":


![image](https://github.com/user-attachments/assets/d8eb3dc3-2f9f-4e95-847e-d24b421249a8)

To ensure these are visible by default when using `o4-mini`, this also
changes the default value for `summary` (formerly `generate_summary`,
which is deprecated in favor of `summary` according to the docs) from
unset to `"auto"`.
2025-05-10 21:43:27 -07:00
Michael Bolin 2c8229ffdc merge commit for archive created by Sapling 2025-05-10 21:04:53 -07:00
Michael Bolin b514e803fa feat: include "reasoning" messages from o4-mini in Rust TUI 2025-05-10 21:04:48 -07:00
Michael Bolin 430e877707 Merge 083468e938 into sapling-pr-archive-bolinfest 2025-05-10 21:00:05 -07:00
Michael Bolin 083468e938 feat: include "reasoning" messages from o4-mini in Rust TUI 2025-05-10 20:59:59 -07:00
Michael Bolin 2b122da087 feat: add support for AGENTS.md in Rust CLI (#885)
The TypeScript CLI already has support for including the contents of
`AGENTS.md` in the instructions sent with the first turn of a
conversation. This PR brings this functionality to the Rust CLI.

To be considered, `AGENTS.md` must be in the `cwd` of the session, or in
one of the parent folders up to a Git/filesystem root (whichever is
encountered first).

By default, a maximum of 32 KiB of `AGENTS.md` will be included, though
this is configurable using the new-in-this-PR `project_doc_max_bytes`
option in `config.toml`.
codex-rs-7f24ec8cae83ae22e7cc306fea4844958370827d-1-rust-v0.0.2505101753
2025-05-10 17:52:59 -07:00
Michael Bolin da336f6493 Merge e9bc071642 into sapling-pr-archive-bolinfest 2025-05-10 17:42:41 -07:00
Michael Bolin e9bc071642 feat: add support for AGENTS.md (formerly CODEX.md) 2025-05-10 17:42:35 -07:00
Michael Bolin 2bd1fac552 merge commit for archive created by Sapling 2025-05-10 17:34:47 -07:00
Michael Bolin 3e45baf359 feat: add support for AGENTS.md (formerly CODEX.md) 2025-05-10 17:34:42 -07:00
Michael Bolin 4fa7fb7913 merge commit for archive created by Sapling 2025-05-10 17:30:57 -07:00
Michael Bolin 248946664a feat: add support for AGENTS.md (formerly CODEX.md) 2025-05-10 17:30:42 -07:00
Michael Bolin 4a63914152 merge commit for archive created by Sapling 2025-05-10 17:02:14 -07:00
Michael Bolin 42d90a440f feat: add support for AGENTS.md (formerly CODEX.md) 2025-05-10 17:02:08 -07:00
Corry Haines b42ad670f1 fix: flex-mode via config/flag (#813)
* Add flexMode to stored config, and use it during config loading unless
the flag is explicitly passed.
* If the config asks for flexMode and the model doesn't support it,
silently disable flexMode.

Resolves #803
2025-05-10 16:18:20 -07:00