Commit Graph
1971 Commits
Author SHA1 Message Date
Michael Bolin 62fc235158 merge commit for archive created by Sapling 2025-07-10 11:00:47 -07:00
Michael Bolin 1508d5b851 fix: remove reference to /compact until it is implemented 2025-07-10 11:00:41 -07:00
Michael Bolin 14c4444551 Merge c6e4a65e2a into sapling-pr-archive-bolinfest 2025-07-10 10:59:50 -07:00
Michael Bolin c6e4a65e2a fix: remove reference to /compact until it is implemented 2025-07-10 10:59:42 -07:00
pchuri 3a23a86f4b Add Android platform support for Codex CLI (#1488)
## Summary
Add Android platform support to Codex CLI

## What?
- Added `android` to the list of supported platforms in
`codex-cli/bin/codex.js`
- Treats Android as Linux for binary compatibility

## Why?
- Fixes "Unsupported platform: android (arm64)" error on Termux
- Enables Codex CLI usage on Android devices via Termux
- Improves platform compatibility without affecting other platforms

## How?
- Modified the platform detection switch statement to include `case
"android":`
- Android falls through to the same logic as Linux, using appropriate
ARM64 binaries
- Minimal change with no breaking effects on existing functionality

## Testing
- Tested on Android/Termux environment
- Verified the fix resolves the platform detection error
- Confirmed no impact on other platforms

## Related Issues
Fixes the "Unsupported platform: android (arm64)" error reported by
Termux users
2025-07-09 22:06:55 -07:00
Michael Bolin 268267b59e fix: the completion subcommand should assume the CLI is named codex, not codex-cli (#1496)
Current 0.4.0 release:

```
~/code/codex2/codex-rs$ codex completion | head
_codex-cli() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
```

with this change:

```
~/code/codex2/codex-rs$ just codex completion | head
cargo run --bin codex -- "$@"
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.82s
     Running `target/debug/codex completion`
_codex() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
```
2025-07-09 14:08:35 -07:00
Michael Bolin 799a4b5b87 Merge 9241fe5504 into sapling-pr-archive-bolinfest 2025-07-09 13:53:29 -07:00
Michael Bolin 9241fe5504 fix: the completion subcommand should assume the CLI is named codex, not codex-cli 2025-07-09 13:53:21 -07:00
Michael Bolin 4a15ebc1ca feat: add codex completion to generate shell completions (#1491)
Once this lands, we can update our brew formula to use
`generate_completions_from_executable()` like so:


https://github.com/Homebrew/homebrew-core/blob/905238ff7f8f48fdc6f4ae2a9fbdd364bf7c7f9d/Formula/h/hgrep.rb#L21-L25
2025-07-08 21:43:27 -07:00
Michael Bolin 8d35ad0ef7 feat: honor OPENAI_BASE_URL for the built-in openai provider (#1487)
Some users have proxies or other setups where they are ultimately
hitting OpenAI endpoints, but need a custom `base_url` rather than the
default value of `"https://api.openai.com/v1"`. This PR makes it
possible to override the `base_url` for the `openai` provider via the
`OPENAI_BASE_URL` environment variable.
2025-07-08 12:39:52 -07:00
Michael Bolin 470f1b66db Merge f848318d24 into sapling-pr-archive-bolinfest 2025-07-08 12:34:40 -07:00
Michael Bolin f848318d24 feat: honor OPENAI_BASE_URL for the built-in openai provider 2025-07-08 12:34:33 -07:00
Michael Bolin cc58f1086d docs: document support for model_reasoning_effort and model_reasoning_summary in profiles (#1486)
Documents the new functionality added in
https://github.com/openai/codex/pull/1484.
2025-07-08 12:26:05 -07:00
Michael Bolin c6b150d1ef Merge 8373d17d67 into sapling-pr-archive-bolinfest 2025-07-08 12:22:17 -07:00
Michael Bolin 8373d17d67 docs: document support for model_reasoning_effort and model_reasoning_summary in profiles 2025-07-08 12:22:11 -07:00
Yusuf Eren e444a50cf0 feat: add reasoning fields to profile settings (#1484) 2025-07-08 12:05:22 -07:00
Michael Bolin f80fc86f18 chore: default to the latest version of the Codex CLI in the GitHub Action (#1485)
Now we no longer have to update the default value of `codex_release_tag`
in the GitHub Action going forward.
2025-07-08 12:00:13 -07:00
Michael Bolin 7eb7940863 merge commit for archive created by Sapling 2025-07-08 11:56:35 -07:00
Michael Bolin eff8d43753 chore: update the default version used by the GitHub Action to 0.3.0 2025-07-08 11:56:21 -07:00
Michael Bolin 44f649b503 Merge 83d32ccc83 into sapling-pr-archive-bolinfest 2025-07-08 11:42:38 -07:00
Michael Bolin 83d32ccc83 chore: update the default version used by the GitHub Action to 0.3.0 2025-07-08 11:42:31 -07:00
Michael Bolin 0b9cb2b9e7 chore: create a release script for the Rust CLI (#1479)
This is a stopgap solution before migrating the build for the npm
release to GitHub Actions (which is ultimately what should be done to
ensure hermetic builds).

The idea is that instead of continuing to create PRs like
https://github.com/openai/codex/pull/1472 where I have to check in a
change to the `WORKFLOW_URL`, this script uses `gh run list` to get the
`WORKFLOW_URL` dynamically and then threads the value through to
`install_native_deps.sh`.

To create the 0.3.0 release on npm, I ran:

```shell
./codex-cli/scripts/stage_rust_release.py --release-version 0.3.0
```

and then did `npm publish --dry-run` followed by `npm publish` in the
temp directory created by `stage_rust_release.py`.
2025-07-07 23:51:34 -07:00
Michael Bolin 39659713ae merge commit for archive created by Sapling 2025-07-07 23:43:41 -07:00
Michael Bolin bd6027b4ea chore: create a release script for the Rust CLI 2025-07-07 23:43:35 -07:00
Michael Bolin 48910b2ac9 Merge bdb9bcdac4 into sapling-pr-archive-bolinfest 2025-07-07 23:42:11 -07:00
Michael Bolin bdb9bcdac4 chore: create a release script for the Rust CLI 2025-07-07 23:42:01 -07:00
Michael Bolin e0c08cea4f feat: add support for --sandbox flag (#1476)
On a high-level, we try to design `config.toml` so that you don't have
to "comment out a lot of stuff" when testing different options.

Previously, defining a sandbox policy was somewhat at odds with this
principle because you would define the policy as attributes of
`[sandbox]` like so:

```toml
[sandbox]
mode = "workspace-write"
writable_roots = [ "/tmp" ]
```

but if you wanted to temporarily change to a read-only sandbox, you
might feel compelled to modify your file to be:

```toml
[sandbox]
mode = "read-only"
# mode = "workspace-write"
# writable_roots = [ "/tmp" ]
```

Technically, commenting out `writable_roots` would not be strictly
necessary, as `mode = "read-only"` would ignore `writable_roots`, but
it's still a reasonable thing to do to keep things tidy.

Currently, the various values for `mode` do not support that many
attributes, so this is not that hard to maintain, but one could imagine
this becoming more complex in the future.

In this PR, we change Codex CLI so that it no longer recognizes
`[sandbox]`. Instead, it introduces a top-level option, `sandbox_mode`,
and `[sandbox_workspace_write]` is used to further configure the sandbox
when when `sandbox_mode = "workspace-write"` is used:

```toml
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
writable_roots = [ "/tmp" ]
```

This feels a bit more future-proof in that it is less tedious to
configure different sandboxes:

```toml
sandbox_mode = "workspace-write"

[sandbox_read_only]
# read-only options here...

[sandbox_workspace_write]
writable_roots = [ "/tmp" ]

[sandbox_danger_full_access]
# danger-full-access options here...
```

In this scheme, you never need to comment out the configuration for an
individual sandbox type: you only need to redefine `sandbox_mode`.

Relatedly, previous to this change, a user had to do `-c
sandbox.mode=read-only` to change the mode on the command line. With
this change, things are arguably a bit cleaner because the equivalent
option is `-c sandbox_mode=read-only` (and now `-c
sandbox_workspace_write=...` can be set separately).

Though more importantly, we introduce the `-s/--sandbox` option to the
CLI, which maps directly to `sandbox_mode` in `config.toml`, making
config override behavior easier to reason about. Moreover, as you can
see in the updates to the various Markdown files, it is much easier to
explain how to configure sandboxing when things like `--sandbox
read-only` can be used as an example.

Relatedly, this cleanup also made it straightforward to add support for
a `sandbox` option for Codex when used as an MCP server (see the changes
to `mcp-server/src/codex_tool_config.rs`).

Fixes https://github.com/openai/codex/issues/1248.
2025-07-07 22:31:30 -07:00
Michael Bolin 3221d2734a merge commit for archive created by Sapling 2025-07-07 22:26:02 -07:00
Michael Bolin d830be38a7 feat: add support for --sandbox flag 2025-07-07 22:25:57 -07:00
Michael Bolin 8160a140a1 merge commit for archive created by Sapling 2025-07-07 22:14:17 -07:00
Michael Bolin b752023126 feat: add support for --sandbox flag 2025-07-07 22:14:11 -07:00
Michael Bolin cfa25927b0 Merge 1cd9d47117 into sapling-pr-archive-bolinfest 2025-07-07 22:13:24 -07:00
Michael Bolin 1cd9d47117 feat: add support for --sandbox flag 2025-07-07 22:13:19 -07:00
Michael Bolin 05270c9cc8 merge commit for archive created by Sapling 2025-07-07 19:54:17 -07:00
Michael Bolin 8f75cf0bf3 feat: add support for --sandbox flag 2025-07-07 19:54:12 -07:00
Michael Bolin 4cf8c4d363 merge commit for archive created by Sapling 2025-07-07 19:40:01 -07:00
Michael Bolin 59bb84c19a feat: add support for --sandbox flag 2025-07-07 19:38:18 -07:00
Michael Bolin 9cc77fb03b Merge 6d16e22376 into sapling-pr-archive-bolinfest 2025-07-07 19:34:20 -07:00
Michael Bolin 6d16e22376 feat: add support for --sandbox flag 2025-07-07 19:34:14 -07:00
Michael Bolin 0a44c42533 docs: update README to include npm install again (#1475)
v0.2.0 of https://www.npmjs.com/package/@openai/codex now runs the Rust
CLI, so it makes sense to bring back the instructions to use `npm i -g
@openai/codex`.

In most places, I list `npm install` before `brew install` because I
believe `npm` is more readily available, though I in the more detailed
part of the documentation, I note that `brew install` will download
fewer bytes, and in that sense, is preferred.
2025-07-07 17:44:26 -07:00
Michael Bolin 4f39917501 Merge 712308c923 into sapling-pr-archive-bolinfest 2025-07-07 17:39:23 -07:00
Michael Bolin 712308c923 docs: update README to include npm install again 2025-07-07 17:39:16 -07:00
Michael Bolin a9bed68947 chore: normalize repository.url in package.json (#1474)
I got this as a warning when doing `npm publish --dry-run`, so I ran
`npm pkg fix` to create this PR, as instructed.
2025-07-07 16:33:06 -07:00
Michael Bolin 66ddf6d4c2 Merge d0dac98004 into sapling-pr-archive-bolinfest 2025-07-07 16:31:50 -07:00
Michael Bolin d0dac98004 chore: normalize repository.url in package.json 2025-07-07 16:31:43 -07:00
ryoziandMichael Bolin fd67a0086c Fix Unicode handling in chat_composer "@" token detection (#1467)
## Issues Fixed

- **Primary Issue (#1450)**: Unicode cursor positioning was incorrect
due to mixing character positions with byte positions
- **Additional Issue**: Full-width spaces (CJK whitespace like " ")
weren't properly handled as token boundaries
- ref:
https://doc.rust-lang.org/std/primitive.char.html#method.is_whitespace

---------

Co-authored-by: Michael Bolin <bolinfest@gmail.com>
2025-07-07 13:43:31 -07:00
Michael Bolin c221eab0b5 feat: support custom HTTP headers for model providers (#1473)
This adds support for two new model provider config options:

- `http_headers` for hardcoded (key, value) pairs
- `env_http_headers` for headers whose values should be read from
environment variables

This also updates the built-in `openai` provider to use this feature to
set the following headers:

- `originator` => `codex_cli_rs`
- `version` => [CLI version]
- `OpenAI-Organization` => `OPENAI_ORGANIZATION` env var
- `OpenAI-Project` => `OPENAI_PROJECT` env var

for consistency with the TypeScript implementation:


https://github.com/openai/codex/blob/bd5a9e8ba96c7d9c58ecaf5e61ec62d14ac6378d/codex-cli/src/utils/agent/agent-loop.ts#L321-L329

While here, this also consolidates some logic that was duplicated across
`client.rs` and `chat_completions.rs` by introducing
`ModelProviderInfo.create_request_builder()`.

Resolves https://github.com/openai/codex/discussions/1152
2025-07-07 13:09:16 -07:00
Michael Bolin fc593fc965 Merge 048cd07da9 into sapling-pr-archive-bolinfest 2025-07-07 11:21:50 -07:00
Michael Bolin 048cd07da9 feat: add support for http_headers and env_key_http_headers 2025-07-07 11:21:43 -07:00
Michael Bolin bd5a9e8ba9 chore: update release scripts for the TypeScript CLI (#1472)
This introduces two changes to make a quick fix so we can deploy the
Rust CLI for `0.2.0` of `@openai/codex` on npm:

- Updates `WORKFLOW_URL` to point to
https://github.com/openai/codex/actions/runs/15981617627, which is the
GitHub workflow run used to create the binaries for the `0.2.0` release
we published to Homebrew.
- Adds a `--version` option to `stage_release.sh` to specify what the
`version` field in the `package.json` will be.

Locally, I ran the following:

```
./codex-cli/scripts/stage_release.sh --native --version 0.2.0
```

Previously, we only used the `--native` flag to publish to the `native`
tag of `@openai/codex` (e.g., `npm publish --tag native`), but we should
just publish this as the default tag for `0.2.0` to be consistent with
what is in Homebrew.

We can still publish one "final" version of the TypeScript CLI as 0.1.x
later.

Under the hood, this release will still contain `dist/cli.js`,
`bin/codex-linux-sandbox-x64`, and `bin/codex-x86_64-apple-darwin`,
which are not strictly necessary, but we'll fix that in `0.3.0`.
2025-07-07 09:43:03 -07:00