Commit Graph

1052 Commits

Author SHA1 Message Date
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
Pranav
646e7e9c11 feat: added arceeai as a provider (#818)
- Added ArceeAI as a provider  - https://conductor.arcee.ai/v1
- Compatible with ArceeAI SLMs (Virtuoso, Maestro)
- Works with ArceeAI's Conductor auto‑router models (auto, auto‑tool),
once #817 is merged
2025-05-10 16:16:28 -07:00
Pranav
19262f632f fix: guard against missing choices (#817)
- Fixes guard by using optional chaining to safely check
chunk.choices?.[0] before accessing.
- Currently, accessing chunk.choices[0] without checking could throw if
choices was missing from the chunk.
2025-05-10 16:16:19 -07:00
Corry Haines
fcc76cf3e7 Add reasoning effort option to CLI help text (#815)
Reasoning effort was already available, but not expressed into the help
text, so it was non-discoverable.

Other issues discovered, but will fix in separate PR since they are
larger:
* #816 reasoningEffort isn't displayed in the terminal-header, making it
rather hard to see the state of configuration
* I don't think the config file setting works, as the CLI option always
"wins" and overwrites it
2025-05-10 15:58:59 -07:00
Fouad Matin
3104d81b7b fix: migrate to AGENTS.md (#764)
Migrate from `codex.md` to `AGENTS.md`
2025-05-10 15:57:49 -07:00
Tomas Cupr
e307d007aa fix: retry on OpenAI server_error even without status code (#814)
Fix: retry on server_error responses that lack an HTTP status code

### What happened

1. An OpenAI endpoint returned a **5xx** (transient server-side
failure).
2. The SDK surfaced it as an `APIError` with

{ "type": "server_error", "message": "...", "status": undefined }

           (The SDK does not always populate `status` for these cases.)
3. Our retry logic in `src/utils/agent/agent-loop.ts` determined

isServerError = typeof status === "number" && status >= 500;

Because `status` was *undefined*, the error was **not** recognised as
retriable, the exception bubbled out, and the CLI crashed with a stack
           trace similar to:

               Error: An error occurred while processing the request.
                   at .../cli.js:474:1514

### Root cause

The transient-error detector ignored the semantic flag type ===
"server_error" that the SDK provides when the numeric status is missing.

#### Fix (1 loc + comment)

Extend the check:

const status = errCtx?.status ?? errCtx?.httpStatus ??
errCtx?.statusCode;

const isServerError = (typeof status === "number" && status >= 500) ||
// classic 5xx
errCtx?.type === "server_error";                   // <-- NEW

Now the agent:

* Retries up to **5** times (existing logic) when the backend reports a
transient failure, even if `status` is absent.
* If all retries fail, surfaces the existing friendly system message
instead of an uncaught exception.

### Tests & validation

pnpm test # all suites green (17 agent-level tests now include this
path)
pnpm run lint    # 0 errors / warnings
pnpm run typecheck

A new unit-test file isn’t required—the behaviour is already covered by
tests/agent-server-retry.test.ts, which stubs type: "server_error" and
now passes with the updated logic.

### Impact

* No API-surface changes.
* Prevents CLI crashes on intermittent OpenAI outages.
* Adds robust handling for other providers that may follow the same
error-shape.
2025-05-10 15:43:03 -07:00