Commit Graph

11364 Commits

Author SHA1 Message Date
Michael Bolin
8344fd2917 merge commit for archive created by Sapling 2025-04-28 12:19:16 -07:00
Michael Bolin
ea47723b8f fix: tighten up check for /usr/bin/sandbox-exec 2025-04-28 12:19:12 -07:00
Michael Bolin
531ebac59c Merge decb0cc953 into sapling-pr-archive-bolinfest 2025-04-28 12:13:59 -07:00
Michael Bolin
decb0cc953 fix: tighten up check for /usr/bin/sandbox-exec 2025-04-28 12:13:52 -07:00
Michael Bolin
77e2918049 fix: drop d as keyboard shortcut for scrolling in the TUI (#704)
The existing `b` and `space` are sufficient and `d` and `u` default to
half-page scrolling in `less`, so the way we supported `d` and `u`
wasn't faithful to that, anyway:

https://man7.org/linux/man-pages/man1/less.1.html

If we decide to bring `d` and `u` back, they should probably match
`less`?
2025-04-28 10:39:58 -07:00
Michael Bolin
f3b4195009 Merge 8deabff73f into sapling-pr-archive-bolinfest 2025-04-28 09:28:56 -07:00
Michael Bolin
8deabff73f fix: drop d as keyboard shortcut for scrolling in the TUI 2025-04-28 09:28:38 -07:00
Michael Bolin
5a5024334f Merge 07c1f65e65 into sapling-pr-archive-bolinfest 2025-04-28 09:21:56 -07:00
Michael Bolin
07c1f65e65 fix: drop d as keyboard shortcut for scrolling in the TUI 2025-04-28 09:21:49 -07:00
Thibault Sottiaux
fa5fa8effc fix: only allow running without sandbox if explicitly marked in safe container (#699)
Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-28 07:48:38 -07:00
Michael Bolin
4eda4dd772 feat: load defaults into Config and introduce ConfigOverrides (#677)
This changes how instantiating `Config` works and also adds
`approval_policy` and `sandbox_policy` as fields. The idea is:

* All fields of `Config` have appropriate default values.
* `Config` is initially loaded from `~/.codex/config.toml`, so values in
`config.toml` will override those defaults.
* Clients must instantiate `Config` via
`Config::load_with_overrides(ConfigOverrides)` where `ConfigOverrides`
has optional overrides that are expected to be settable based on CLI
flags.

The `Config` should be defined early in the program and then passed
down. Now functions like `init_codex()` take fewer individual parameters
because they can just take a `Config`.

Also, `Config::load()` used to fail silently if `~/.codex/config.toml`
had a parse error and fell back to the default config. This seemed
really bad because it wasn't clear why the values in my `config.toml`
weren't getting picked up. I changed things so that
`load_with_overrides()` returns `Result<Config>` and verified that the
various CLIs print a reasonable error if `config.toml` is malformed.

Finally, I also updated the TUI to show which **sandbox** value is being
used, as we do for other key values like **model** and **approval**.
This was also a reminder that the various values of `--sandbox` are
honored on Linux but not macOS today, so I added some TODOs about fixing
that.
2025-04-27 21:47:50 -07:00
Thibault Sottiaux
e9d16d3c2b fix: check if sandbox-exec is available (#696)
- Introduce `isSandboxExecAvailable()` helper and tidy import ordering
in `handle-exec-command.ts`.
- Add runtime check for the `sandbox-exec` binary on macOS; fall back to
`SandboxType.NONE` with a warning if it’s missing, preventing crashes.

---------

Signed-off-by: Thibault Sottiaux <tibo@openai.com>
Co-authored-by: Fouad Matin <fouad@openai.com>
2025-04-27 17:04:47 -07:00
Fouad Matin
523996b5cb fix: /diff should include untracked files (#686) 2025-04-26 12:43:51 -07:00
Tomas Cupr
bc500d3009 feat: user config api key (#569)
Adds support for reading OPENAI_API_KEY (and other variables) from a
user‑wide dotenv file (~/.codex.config). Precedence order is now:
  1. explicit environment variable
  2. project‑local .env (loaded earlier)
  3. ~/.codex.config

Also adds a regression test that ensures the multiline editor correctly
handles cases where printable text and the CSI‑u Shift+Enter sequence
arrive in the same input chunk.

House‑kept with Prettier; removed stray temp.json artifact.
2025-04-26 10:13:30 -07:00
moppywhip
9b0ccf9aeb fix: duplicate messages in quiet mode (#680)
Addressing #600 and #664 (partially)

## Bug
Codex was staging duplicate items in output running when the same
response item appeared in both the streaming events. Specifically:

1. Items would be staged once when received as a
`response.output_item.done` event
2. The same items would be staged again when included in the final
`response.completed` payload

This duplication would result in each message being sent several times
in the quiet mode output.

## Changes
- Added a Set (`alreadyStagedItemIds`) to track items that have already
been staged
- Modified the `stageItem` function to check if an item's ID is already
in this set before staging it
- Added a regression test (`agent-dedupe-items.test.ts`) that verifies
items with the same ID are only staged once

## Testing
Like other tests, the included test creates a mock OpenAI stream that
emits the same message twice (once as an incremental event and once in
the final response) and verifies the item is only passed to `onItem`
once.
2025-04-26 09:14:50 -07:00
Michael Bolin
bf6990bb5f merge commit for archive created by Sapling 2025-04-25 21:57:38 -07:00
Michael Bolin
1f15594e99 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 21:57:34 -07:00
Michael Bolin
8c0d4280fc merge commit for archive created by Sapling 2025-04-25 21:53:40 -07:00
Michael Bolin
caa48d66b8 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 21:53:35 -07:00
Michael Bolin
cd3c6c929d merge commit for archive created by Sapling 2025-04-25 21:28:34 -07:00
Michael Bolin
18f9ac5c38 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 21:28:29 -07:00
Michael Bolin
886ee2fc58 merge commit for archive created by Sapling 2025-04-25 21:26:22 -07:00
Michael Bolin
43a09e314e feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 21:26:09 -07:00
Michael Bolin
26b2fb9a6f merge commit for archive created by Sapling 2025-04-25 21:23:30 -07:00
Michael Bolin
e72e201fb1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 21:23:26 -07:00
Michael Bolin
a5ad1cf002 merge commit for archive created by Sapling 2025-04-25 20:49:56 -07:00
Michael Bolin
c4bafdca9c feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 20:49:51 -07:00
Michael Bolin
7a6d918234 Merge e4ad444fd1 into sapling-pr-archive-bolinfest 2025-04-25 20:45:22 -07:00
Michael Bolin
e4ad444fd1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 20:44:51 -07:00
Michael Bolin
21f036a511 merge commit for archive created by Sapling 2025-04-25 20:41:29 -07:00
Michael Bolin
fc1d6b1b6f feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 20:41:20 -07:00
Michael Bolin
a400649687 Merge 3a555869c1 into sapling-pr-archive-bolinfest 2025-04-25 19:51:37 -07:00
Michael Bolin
3a555869c1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:51:33 -07:00
Michael Bolin
931877fb82 merge commit for archive created by Sapling 2025-04-25 19:51:04 -07:00
Michael Bolin
ffbcccc219 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:50:58 -07:00
Michael Bolin
2e541ccd39 merge commit for archive created by Sapling 2025-04-25 19:34:27 -07:00
Michael Bolin
70097dbaa1 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 19:34:19 -07:00
Michael Bolin
5f4d72de17 merge commit for archive created by Sapling 2025-04-25 18:04:53 -07:00
Michael Bolin
86c2498972 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 18:04:47 -07:00
Michael Bolin
6d5a10b9f4 merge commit for archive created by Sapling 2025-04-25 18:03:44 -07:00
Michael Bolin
707beb21e8 feat: load defaults into Config and introduce ConfigOverrides 2025-04-25 18:03:35 -07:00
Michael Bolin
b0ba65a936 fix: write logs to ~/.codex/log instead of /tmp (#669)
Previously, the Rust TUI was writing log files to `/tmp`, which is
world-readable and not available on Windows, so that isn't great.

This PR tries to clean things up by adding a function that provides the
path to the "Codex config dir," e.g., `~/.codex` (though I suppose we
could support `$CODEX_HOME` to override this?) and then defines other
paths in terms of the result of `codex_dir()`.

For example, `log_dir()` returns the folder where log files should be
written which is defined in terms of `codex_dir()`. I updated the TUI to
use this function. On UNIX, we even go so far as to `chmod 600` the log
file by default, though as noted in a comment, it's a bit tedious to do
the equivalent on Windows, so we just let that go for now.

This also changes the default logging level to `info` for `codex_core`
and `codex_tui` when `RUST_LOG` is not specified. I'm not really sure if
we should use a more verbose default (it may be helpful when debugging
user issues), though if so, we should probably also set up log rotation?
2025-04-25 17:37:41 -07:00
Fouad Matin
103093f793 bump(version): 0.1.2504251709 (#660)
## `0.1.2504251709`

### 🚀 Features

- Add openai model info configuration (#551)
- Added provider to run quiet mode function (#571)
- Create parent directories when creating new files (#552)
- Print bug report URL in terminal instead of opening browser (#510)
(#528)
- Add support for custom provider configuration in the user config
(#537)
- Add support for OpenAI-Organization and OpenAI-Project headers (#626)
- Add specific instructions for creating API keys in error msg (#581)
- Enhance toCodePoints to prevent potential unicode 14 errors (#615)
- More native keyboard navigation in multiline editor (#655)
- Display error on selection of invalid model (#594)

### 🪲 Bug Fixes

- Model selection (#643)
- Nits in apply patch (#640)
- Input keyboard shortcuts (#676)
- `apply_patch` unicode characters (#625)
- Don't clear turn input before retries (#611)
- More loosely match context for apply_patch (#610)
- Update bug report template - there is no --revision flag (#614)
- Remove outdated copy of text input and external editor feature (#670)
- Remove unreachable "disableResponseStorage" logic flow introduced in
#543 (#573)
- Non-openai mode - fix for gemini content: null, fix 429 to throw
before stream (#563)
- Only allow going up in history when not already in history if input is
empty (#654)
- Do not grant "node" user sudo access when using run_in_container.sh
(#627)
- Update scripts/build_container.sh to use pnpm instead of npm (#631)
- Update lint-staged config to use pnpm --filter (#582)
- Non-openai mode - don't default temp and top_p (#572)
- Fix error catching when checking for updates (#597)
- Close stdin when running an exec tool call (#636)
2025-04-25 17:15:40 -07:00
Fouad Matin
3f4762d969 fix: input keyboard shortcuts (#676)
Fixes keyboard shortcuts:
- ctrl+a/e
- opt+arrow keys
2025-04-25 16:58:09 -07:00
Michael Bolin
948a91096a Merge 0492b91d38 into sapling-pr-archive-bolinfest 2025-04-25 16:34:37 -07:00
Michael Bolin
0492b91d38 fix: use os-specific env var to locate .cargo folder 2025-04-25 16:34:29 -07:00
Michael Bolin
0705963691 Merge 532da04bb4 into sapling-pr-archive-bolinfest 2025-04-25 16:22:39 -07:00
Michael Bolin
532da04bb4 fix: write logs to ~/.codex/log instead of /tmp 2025-04-25 16:22:33 -07:00
Michael Bolin
f3ee933a74 ci: build Rust on Windows as part of CI (#665)
While we aren't ready to provide Windows binaries of Codex CLI, it seems
like a good idea to ensure we guard platform-specific code
appropriately.
2025-04-25 16:22:16 -07:00
Thibault Sottiaux
44d68f9dbf fix: remove outdated copy of text input and external editor feature (#670)
Signed-off-by: Thibault Sottiaux <tibo@openai.com>
2025-04-25 16:11:16 -07:00