Commit Graph
94 Commits
Author SHA1 Message Date
just-every-code 2c5c3b42da merge(upstream): sync with openai/codex main into upstream-merge\n\n- Prefer upstream in core: adopt new ToolsConfig API and OpenAI tools plumbing\n- Keep our TUI/tooling; no conflicts in prefer-ours buckets\n- Purge rules respected; no reintroduced assets\n\nBuild: ./build-fast.sh ok; verify.sh ok 2025-09-10 22:27:14 +00:00
James Peter 019266c865 feat(tui/spinner): LLM-driven custom spinner flow with live streaming, JSON schema, and preview\n\n- Replace manual custom form with prompt-based generator\n- Send text.format=json_schema (strict), enforce interval 50–300ms, 2–50 frames, 1–20 chars; truncate + left-pad frames\n- Live in-box streaming during generation with wrapping; dimmed line with postfix\n- Loading view: title + spinner + "Generating spinner with AI…"\n- Review view: list-style preview row; [Save] [Retry] below preview\n- Enter on Description submits immediately\n- Add CLI: for side-channel structured requests\n- Core: add TextFormat + Prompt.text_format; include text.format in requests 2025-09-10 21:07:43 +10:00
James Peter e6c2be6f6a ux(tui/appearance): overview labels + spinner table with live preview; keep anchored 9-row viewport\n\n- Overview: 'Change theme' / 'Change spinner'\n- Spinner list: ratatui Table [name | Working… <frame>] for easy visual compare\n- Animate table previews; keep colored selector and anchored window\n- Factor list_window::anchored_window for reuse\n\nBuild: ./build-fast.sh clean (no warnings) 2025-09-10 09:47:54 +10:00
James Peter 0b474d3aa0 fix(tui/appearance): implement anchored scrolling (top→center→bottom) and ensure selection visible on entry\n\n- Render-time windowing: top until reaching middle, center while scrolling, bottom shows end\n- Make initial entry show selected row at top one time (then anchor)\n- Remove stateful offsets; keep simple Up/Down selection updates\n- Keep selector colored for dark themes\n\nBuild: ./build-fast.sh clean (no warnings) 2025-09-10 09:28:27 +10:00
Gabriel PealandGitHub 7f496aa29a Replace config.responses_originator_header_internal_override with CODEX_INTERNAL_ORIGINATOR_OVERRIDE_ENV_VAR (#3388)
The previous config approach had a few issues:
1. It is part of the config but not designed to be used externally
2. It had to be wired through many places (look at the +/- on this PR
3. It wasn't guaranteed to be set consistently everywhere because we
don't have a super well defined way that configs stack. For example, the
extension would configure during newConversation but anything that
happened outside of that (like login) wouldn't get it.

This env var approach is cleaner and also creates one less thing we have
to deal with when coming up with a better holistic story around configs.

One downside is that I removed the unit test testing for the override
because I don't want to deal with setting the global env or spawning
child processes and figuring out how to introspect their originator
header. The new code is sufficiently simple and I tested it e2e that I
feel as if this is still worth it.
2025-09-09 17:23:23 -04:00
James Peter b01c52c6d4 feat(cli/preview): save downloads under ~/.code/bin and suffix with PR id\n\nDefault out dir is now ~/.code/bin when -o is not provided.\nRename extracted binary to <name>-<pr> to avoid dropping artifacts into repo. 2025-09-09 20:35:45 +10:00
James Peter d2eed41dfc feat(cli/preview): run binary without --help; simplify PR preview
- Launch binary directly and pass args (no implicit --help)
- Simplify PR preview comment format
- Keep history free of platform binaries
2025-09-09 20:30:55 +10:00
James Peter 9725fdba93 feat(preview): publish prerelease on PR with assets (no auth downloads); update PR comment to recommend 'code preview pr:<number>'; CLI supports pr:<number> and downloads from releases; keep run-id path as fallback 2025-09-09 16:12:04 +10:00
James Peter ee37eca746 feat(ci/preview-build): upload preview-helper script artifact once; list in PR comment 2025-09-09 12:56:17 +10:00
James Peter 83e07abd99 revert: drop unintended preflight test files and release.yml edits; keep only core API tests and upstream-merge prompt/checks 2025-09-09 10:56:07 +10:00
James Peter 74b0c1ca1c test(core/api): add compile-only API surface checks for core re-exports and models alias 2025-09-09 10:54:43 +10:00
James Peter f3cdc6fe59 fix(login): remove /oauth2/token fallback; adopt upstream-visible request shape
- Revert c8b4584 OAuth fallback and Accept header changes.
- Add originator param to authorize URL and ServerOptions.
- Add cancel flow (/cancel route) and bind retry to replace prior server.
- Keep shared HTTP client for TLS robustness; token requests now match upstream path and headers.
2025-09-06 20:56:23 +10:00
James Peter 276ae527af refactor(tui/input): adopt upstream reader-thread Release filtering for #40\n\nMatch origin/main by forwarding only Press|Repeat from the input thread and keeping simple normalization for non-enhanced keyboards. This centralizes the fix and avoids later conditional drops.\n\nNo functional change vs upstream; aligns our tree with main’s solution. 2025-09-06 19:00:24 +10:00
James Peter 1759c50dae feat(tui/layout): align composer/history wrap; add sanitize markers
Introduce layout_consts and replace hardcoded paddings to keep composer and history wrapping identical.

Extend sanitize::Options with debug_markers (default false) and plumb to history cell render paths.

Use codex-version crate for version reporting in TUI and wire crate deps.

Cleanup GitHub CI: remove unused workflows/assets; update issue-triage.
2025-09-05 23:07:36 +10:00
James Peter deb63687bf fix(tui/redraw): ensure scheduled animation frames are not suppressed by debounce
- Add  flag independent of
- Arm exactly one timer for AppEvent::ScheduleFrameIn while allowing immediate redraw debounce
- Prevents welcome logo animation from stalling until input

Also: revert intro color fade profile to original (no visual change request).
2025-09-05 08:21:47 +10:00
pakrym-oaiandGitHub d53ef6fdc1 Include originator in authentication URL parameters (#3117)
Associates the client with an authentication session.
2025-09-03 16:51:00 -07:00
James Peter 9c650fbad8 fix(core): complete upstream integration
- Update all AuthManager::shared and CodexAuth::from_codex_home call sites with originator
- Use rollout::policy helper to filter persisted items
- Fix shell tool description formatting and UA helper reference
- Remove unused import in chatgpt_client

Build: ./build-fast.sh clean with zero warnings
2025-09-04 07:21:34 +10:00
pakrym-oaiandGitHub 523e1e9f19 Add a common way to create HTTP client (#3110)
Ensure User-Agent and originator are always sent.
2025-09-03 10:11:02 -07:00
James Peter 08609e46c7 merge: integrate upstream/main (prefer ours); keep TUI fork, drop legacy vt100 tests, retain local common.rs 2025-09-03 19:49:35 +10:00
James Peter e3a13174f4 chore(codex-rs): clean up tree; add CLI order_replay
- Remove legacy TUI test suite and large fixtures
- Add cli/src/bin/order_replay.rs for output-order analysis
- Update TUI streaming and widgets; minor core protocol/client tweaks
- Update Cargo manifests/lockfile

Build verified with ./build-fast.sh
2025-09-03 19:47:03 +10:00
pakrym-oaiandGitHub e5e9f27c79 Move CodexAuth and AuthManager to the core crate (#3074)
Fix a long standing layering issue.
2025-09-02 18:36:19 -07:00
James Peter 9c95a987a6 Prefer CODE_VERSION with fallback to CARGO_PKG_VERSION across codex-rs\n\n- Replace direct env!("CARGO_PKG_VERSION") with option_env!("CODE_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"))\n- Update clap version field, TUI upgrade banners, user agent, MCP client init, and OpenAI header\n- Verified via ./build-fast.sh 2025-08-25 08:39:26 +10:00
James Peter b60a88d2a1 Merge upstream/main; align protocol/core; revert TUI to fork and adapt; fix build 2025-08-23 18:13:52 +10:00
Eric TrautandGitHub 436bfc2bc9 Add AuthManager and enhance GetAuthStatus command (#2577)
This PR adds a central `AuthManager` struct that manages the auth
information used across conversations and the MCP server. Prior to this,
each conversation and the MCP server got their own private snapshots of
the auth information, and changes to one (such as a logout or token
refresh) were not seen by others.

This is especially problematic when multiple instances of the CLI are
run. For example, consider the case where you start CLI 1 and log in to
ChatGPT account X and then start CLI 2 and log out and then log in to
ChatGPT account Y. The conversation in CLI 1 is still using account X,
but if you create a new conversation, it will suddenly (and
unexpectedly) switch to account Y.

With the `AuthManager`, auth information is read from disk at the time
the `ConversationManager` is constructed, and it is cached in memory.
All new conversations use this same auth information, as do any token
refreshes.

The `AuthManager` is also used by the MCP server's GetAuthStatus
command, which now returns the auth method currently used by the MCP
server.

This PR also includes an enhancement to the GetAuthStatus command. It
now accepts two new (optional) input parameters: `include_token` and
`refresh_token`. Callers can use this to request the in-use auth token
and can optionally request to refresh the token.

The PR also adds tests for the login and auth APIs that I recently added
to the MCP server.
2025-08-22 13:10:11 -07:00
James Peter 9aad892f29 Merge remote-tracking branch 'upstream/main' into merge-upstream-20250822-232701 2025-08-22 23:27:10 +10:00
Eric TrautandGitHub d10eeefaf0 Added new auth-related methods and events to mcp server (#2496)
This PR adds the following:
* A getAuthStatus method on the mcp server. This returns the auth method
currently in use (chatgpt or apikey) or none if the user is not
authenticated. It also returns the "preferred auth method" which
reflects the `preferred_auth_method` value in the config.
* A logout method on the mcp server. If called, it logs out the user and
deletes the `auth.json` file — the same behavior in the cli's `/logout`
command.
* An `authStatusChange` event notification that is sent when the auth
status changes due to successful login or logout operations.
* Logic to pass command-line config overrides to the mcp server at
startup time. This allows use cases like `codex mcp -c
preferred_auth_method=apikey`.
2025-08-20 20:36:34 -07:00
James Peter 14148bbdab merge: upstream/main into fork (prefer ours)\n\n- TUI: adopt upstream custom_terminal and auth widget; keep themes/browser/agents intact\n- Fix stable Rust let-chains across core/tui/cli/mcp-server\n- Align toolchains: build-fast.sh uses rustup (1.89.0 via rust-toolchain.toml); release.yml -> 1.89.0\n- core: file locking via fs2, remove std TryLockError usage\n- mcp-server: keep our impl; avoid upstream-only EventMsg variant\n- TUI fixes: selection list module/export, render_rows arg, history token usage, formatting utils\n- cli/login: remove preferred_auth_method, fix env var let-chain\n\nBuild: ./build-fast.sh passes with Rust 1.89.0 2025-08-20 09:55:17 +10:00
James Peter 0e00fafc15 Merge upstream/main into fork (prefer ours)
# Conflicts:
#	codex-rs/tui/src/custom_terminal.rs
2025-08-20 08:13:33 +10:00
Michael BolinandGitHub 3624515ce5 chore: upgrade to Rust 1.89 (#2465)
Codex created this PR from the following prompt:

> upgrade this entire repo to Rust 1.89. Note that this requires
updating codex-rs/rust-toolchain.toml as well as the workflows in
.github/. Make sure that things are "clippy clean" as this change will
likely uncover new Clippy errors. `just fmt` and `cargo clippy --tests`
are sufficient to check for correctness

Note this modifies a lot of lines because it folds nested `if`
statements using `&&`.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2465).
* #2467
* __->__ #2465
2025-08-19 13:22:02 -07:00
Ahmed IbrahimandGitHub b7f8a5d444 Show login options when not signed in with ChatGPT (#2440)
Motivation: we have users who uses their API key although they want to
use ChatGPT account. We want to give them the chance to always login
with their account.

This PR displays login options when the user is not signed in with
ChatGPT. Even if you have set an OpenAI API key as an environment
variable, you will still be prompted to log in with ChatGPT.

We’ve also added a new flag, `always_use_api_key_signing` false by
default, which ensures you are never asked to log in with ChatGPT and
always defaults to using your API key.



https://github.com/user-attachments/assets/b61ebfa9-3c5e-4ab7-bf94-395c23a0e0af

After ChatGPT sign in:


https://github.com/user-attachments/assets/d58b366b-c46a-428f-a22f-2ac230f991c0
2025-08-19 03:22:48 +00:00
James Peter 140c2adad3 merge: upstream sync via merge/upstream-2025-08-19 (prefer ours) 2025-08-19 11:51:02 +10:00
Michael BolinandGitHub 443a8e56aa fix: remove shutdown_flag param to run_login_server() (#2399)
In practice, this was always passed in as `None`, so eliminated the
param and updated all the call sites.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2399).
* __->__ #2399
* #2398
* #2396
* #2395
* #2394
* #2393
* #2389
2025-08-19 01:15:50 +00:00
Michael BolinandGitHub 70e320d297 fix: async-ify login flow (#2393)
This replaces blocking I/O with async/non-blocking I/O in a number of
cases. This facilitates the use of `tokio::sync::Notify` and
`tokio::select!` in #2394.









---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2393).
* #2399
* #2398
* #2396
* #2395
* #2394
* __->__ #2393
* #2389
2025-08-18 17:23:40 -07:00
James Peter b2f1f9b342 merge: pull latest upstream (prefer ours) 2025-08-19 08:09:24 +10:00
Michael BolinandGitHub be4eaf53dc protocol-ts (#2425) 2025-08-18 13:08:53 -07:00
James Peter 50ea7a0c55 merge: resolve modify/delete conflicts by keeping ours (tui colors, mcp conversation + create_conversation) 2025-08-19 03:23:56 +10:00
Michael BolinandGitHub d34af94b46 chore: move mcp-server/src/wire_format.rs to protocol/src/mcp_protocol.rs (#2423)
The existing `wire_format.rs` should share more types with the
`codex-protocol` crate (like `AskForApproval` instead of maintaining a
parallel `CodexToolCallApprovalPolicy` enum), so this PR moves
`wire_format.rs` into `codex-protocol`, renaming it as
`mcp-protocol.rs`. We also de-dupe types, where appropriate.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2423).
* #2424
* __->__ #2423
2025-08-18 09:36:57 -07:00
James Peter fc17d512b7 refactor(naming): switch binaries and artifacts from 'coder' to 'code'; keep 'coder' as fallback alias only. Update workflows, scripts, and postinstall. 2025-08-17 20:45:10 +10:00
James Peter 5f53c4e902 merge(upstream): resolve conflicts preferring our TUI/theme; add protocol shim and config mappings (Phase 2) 2025-08-17 19:29:05 +10:00
pakrym-oaiandGitHub bb01764a39 Remove duplicated "Successfully logged in message" (#2357) 2025-08-15 13:01:27 -07:00
pakrym-oaiandGitHub 942237f371 Cleanup rust login server a bit more (#2331)
Remove some extra abstractions.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2025-08-14 19:42:14 -07:00
James Peter 7ab4f7d68a Merge upstream/main - preserve local architecture and theming
- Preserved local enum-based HistoryCell architecture
- Kept local theming system with background colors
- Incorporated upstream timing features for exec commands
- Ported login server from Python to Rust (upstream change)
- Added terminal resize handling from upstream
- Resolved all merge conflicts while maintaining local customizations
2025-08-15 10:53:07 +10:00
easong-openaiandGitHub cce41cd82d Port login server to rust (#2294)
Port the login server to rust.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2025-08-14 17:11:26 -07:00
Michael BolinandGitHub b1a8f35f00 fix: run python_multiprocessing_lock_works integration test on Mac and Linux (#2318)
The high-order bit on this PR is that it makes it so `sandbox.rs` tests
both Mac and Linux, as we introduce a general
`spawn_command_under_sandbox()` function with platform-specific
implementations for testing.

An important, and interesting, discovery in porting the test to Linux is
that (for reasons cited in the code comments), `/dev/shm` has to be
added to `writable_roots` on Linux in order for `multiprocessing.Lock`
to work there. Granting write access to `/dev/shm` comes with some
degree of risk, so we do not make this the default for Codex CLI.

Piggybacking on top of #2317, this moves the
`python_multiprocessing_lock_works` test yet again, moving
`codex-rs/core/tests/sandbox.rs` to `codex-rs/exec/tests/sandbox.rs`
because in `codex-rs/exec/tests` we can use `cargo_bin()` like so:

```
let codex_linux_sandbox_exe = assert_cmd::cargo::cargo_bin("codex-exec");
```

which is necessary so we can use `codex_linux_sandbox_exe` and therefore
`spawn_command_under_linux_sandbox` in an integration test.

This also moves `spawn_command_under_linux_sandbox()` out of `exec.rs`
and into `landlock.rs`, which makes things more consistent with
`seatbelt.rs` in `codex-core`.

For reference, https://github.com/openai/codex/pull/1808 is the PR that
made the change to Seatbelt to get this test to pass on Mac.
2025-08-14 15:47:48 -07:00
James PeterandHanzo Dev c9b15df5db Preserve local customizations before upstream merge
- Modified core client and config components
- Enhanced TUI components including chatwidget and bottom pane
- Added verbosity selection view
- Various architectural improvements and local customizations

Co-authored-by: Hanzo Dev <[email protected]>
2025-08-15 08:14:51 +10:00
James Peter b67a0da2b1 Merge upstream changes from openai/codex
Successfully merged all upstream changes while preserving our custom functionality:
- Kept our browser integration and screenshot features
- Preserved agent tracking and multi-agent support
- Maintained our live ring widget and custom UI components
- Integrated upstream's streaming improvements and new conversation manager
- Combined both versions' protocol updates and event handling

All conflicts resolved with preference for our functionality where there were genuine differences.
2025-08-14 08:16:36 +10:00
Michael BolinandGitHub e8f1453f8a chore: introduce ConversationManager as a clearinghouse for all conversations (#2240)
This PR does two things because after I got deep into the first one I
started pulling on the thread to the second:

- Makes `ConversationManager` the place where all in-memory
conversations are created and stored. Previously, `MessageProcessor` in
the `codex-mcp-server` crate was doing this via its `session_map`, but
this is something that should be done in `codex-core`.
- It unwinds the `ctrl_c: tokio::sync::Notify` that was threaded
throughout our code. I think this made sense at one time, but now that
we handle Ctrl-C within the TUI and have a proper `Op::Interrupt` event,
I don't think this was quite right, so I removed it. For `codex exec`
and `codex proto`, we now use `tokio::signal::ctrl_c()` directly, but we
no longer make `Notify` a field of `Codex` or `CodexConversation`.

Changes of note:

- Adds the files `conversation_manager.rs` and `codex_conversation.rs`
to `codex-core`.
- `Codex` and `CodexSpawnOk` are no longer exported from `codex-core`:
other crates must use `CodexConversation` instead (which is created via
`ConversationManager`).
- `core/src/codex_wrapper.rs` has been deleted in favor of
`ConversationManager`.
- `ConversationManager::new_conversation()` returns `NewConversation`,
which is in line with the `new_conversation` tool we want to add to the
MCP server. Note `NewConversation` includes `SessionConfiguredEvent`, so
we eliminate checks in cases like `codex-rs/core/tests/client.rs` to
verify `SessionConfiguredEvent` is the first event because that is now
internal to `ConversationManager`.
- Quite a bit of code was deleted from
`codex-rs/mcp-server/src/message_processor.rs` since it no longer has to
manage multiple conversations itself: it goes through
`ConversationManager` instead.
- `core/tests/live_agent.rs` has been deleted because I had to update a
bunch of tests and all the tests in here were ignored, and I don't think
anyone ever ran them, so this was just technical debt, at this point.
- Removed `notify_on_sigint()` from `util.rs` (and in a follow-up, I
hope to refactor the blandly-named `util.rs` into more descriptive
files).
- In general, I started replacing local variables named `codex` as
`conversation`, where appropriate, though admittedly I didn't do it
through all the integration tests because that would have added a lot of
noise to this PR.




---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2240).
* #2264
* #2263
* __->__ #2240
2025-08-13 13:38:18 -07:00
pakrym-oaiandGitHub 7964922516 fix: display canonical command name in help (#2246)
## Summary
- ensure CLI help uses `codex` as program name regardless of binary
filename

## Testing
- `just fmt`
- `just fix` *(fails: `let` expressions in this position are unstable)*
- `cargo test --all-features` *(fails: `let` expressions in this
position are unstable)*

------
https://chatgpt.com/codex/tasks/task_i_689bd5a731188320814dcbbc546ce22a
2025-08-13 09:39:11 -07:00
James Peter e88aebf24f feat: add coder fork enhancements - mouse scrolling, glitch animation, and improved TUI 2025-08-11 21:51:46 +10:00
James Peter 279e211228 feat: set up code fork with rebranding and npm publishing
- Rename binaries from codex to code across all Cargo.toml files
- Create @just-every/code npm package with generic build scripts
- Add CODE_HOME environment variable support (falls back to CODEX_HOME)
- Create GitHub Actions workflow for automated npm releases
- Update JavaScript wrapper from codex.js to code.js
- Add FORK_SETUP.md documentation
- Configure dual-branch strategy for fork management
2025-08-10 15:57:12 +10:00