Commit Graph

20 Commits

  • Persist update dismissal without cache (#27783)
    ## Summary
    
    Choosing “Don’t remind me” can silently fail when `version.json`
    disappears before dismissal because `dismiss_version` returns success
    without writing anything. The same update can then reappear on the next
    launch.
    
    Initialize a minimal `VersionInfo` from the selected version when the
    cache cannot be read, then persist the dismissal through the existing
    write path.
    
    Fixes #27147
  • Guard npm update readiness (#19389)
    ## Why
    For npm/Bun-managed installs, the update prompt was treating the latest
    GitHub release as ready to install. During the `0.124.0` release, GitHub
    and npm visibility were not atomic: the root npm wrapper could become
    visible before the npm registry marked that version as the package
    `latest`. That left a window where users could be prompted to upgrade
    before npm was ready for the release.
    
    ## What changed
    - Keep GitHub Releases as the candidate latest-version source for
    npm/Bun installs, but only write the existing `version.json` cache after
    npm registry metadata proves that same root version is ready.
    - Add `codex-rs/tui/src/npm_registry.rs` to validate npm readiness by
    checking `dist-tags.latest` and root package `dist` metadata for the
    GitHub candidate version.
    - Move version parsing helpers into
    `codex-rs/tui/src/update_versions.rs` so that logic can be tested
    without compiling the release-only `updates.rs` module under tests.
    - Update `.github/workflows/rust-release.yml` so the six known platform
    tarballs publish before the root `@openai/codex` wrapper. Other npm
    tarballs publish before the root wrapper, and the SDK publishes after
    the root package it depends on.
  • Fix tui compilation (#17691)
    The recent release broke, codex suggested this as the fix
    
    Source failure:
    https://github.com/openai/codex/actions/runs/24362949066/job/71147202092
    
    Probably from
    https://github.com/openai/codex/commit/ac82443d073f7f9a2248bad51bae2fa424ef4946
    
    For why it got in:
    ```
    The relevant setup:
    
    .github/workflows/rust-ci.yml (line 1) runs on PRs, but for codex-rs it only does:
    
    cargo fmt --check
    cargo shear
    argument-comment lint via Bazel
    no cargo check, no cargo clippy over the workspace, no cargo test over codex-tui
    .github/workflows/rust-ci-full.yml (line 1) runs on pushes to main and branches matching **full-ci**. That one does compile TUI because:
    
    codex-rs/Cargo.toml includes "tui" as a workspace member
    lint_build runs cargo clippy --target ... --tests --profile ...
    the matrix includes both dev and release profiles
    tests runs cargo nextest run ..., but only dev-profile tests
    Release CI also compiles it indirectly. .github/workflows/rust-release.yml (line 235) builds --bin codex, and cli/Cargo.toml (line 46) depends on codex-tui.
    ```
    
    Codex tested locally with `cargo check -p codex-tui --release` and was
    able to repro, and verified that this fixed it
  • TUI: enforce core boundary (#17399)
    Problem: The TUI still depended on `codex-core` directly in a number of
    places, and we had no enforcement from keeping this problem from getting
    worse.
    
    Solution: Route TUI core access through
    `codex-app-server-client::legacy_core`, add CI enforcement for that
    boundary, and re-export this legacy bridge inside the TUI as
    `crate::legacy_core` so the remaining call sites stay readable. There is
    no functional change in this PR — just changes to import targets.
    
    Over time, we can whittle away at the remaining symbols in this legacy
    namespace with the eventual goal of removing them all. In the meantime,
    this linter rule will prevent us from inadvertently importing new
    symbols from core.
  • Skip update prompts for source builds (#17186)
    Addresses #17166
    
    Problem: Source builds report version 0.0.0, so the TUI update path can
    treat any released Codex version as upgradeable and show startup or
    popup prompts.
    
    Solution: Skip both TUI update prompt entry points when the running CLI
    version is the source-build sentinel 0.0.0.
  • core: remove cross-crate re-exports from lib.rs (#16512)
    ## Why
    
    `codex-core` was re-exporting APIs owned by sibling `codex-*` crates,
    which made downstream crates depend on `codex-core` as a proxy module
    instead of the actual owner crate.
    
    Removing those forwards makes crate boundaries explicit and lets leaf
    crates drop unnecessary `codex-core` dependencies. In this PR, this
    reduces the dependency on `codex-core` to `codex-login` in the following
    files:
    
    ```
    codex-rs/backend-client/Cargo.toml
    codex-rs/mcp-server/tests/common/Cargo.toml
    ```
    
    ## What
    
    - Remove `codex-rs/core/src/lib.rs` re-exports for symbols owned by
    `codex-login`, `codex-mcp`, `codex-rollout`, `codex-analytics`,
    `codex-protocol`, `codex-shell-command`, `codex-sandboxing`,
    `codex-tools`, and `codex-utils-path`.
    - Delete the `default_client` forwarding shim in `codex-rs/core`.
    - Update in-crate and downstream callsites to import directly from the
    owning `codex-*` crate.
    - Add direct Cargo dependencies where callsites now target the owner
    crate, and remove `codex-core` from `codex-rs/backend-client`.
  • Rename tui_app_server to tui (#16104)
    This is a follow-up to https://github.com/openai/codex/pull/15922. That
    previous PR deleted the old `tui` directory and left the new
    `tui_app_server` directory in place. This PR renames `tui_app_server` to
    `tui` and fixes up all references.
  • Remove the legacy TUI split (#15922)
    This is the part 1 of 2 PRs that will delete the `tui` /
    `tui_app_server` split. This part simply deletes the existing `tui`
    directory and marks the `tui_app_server` feature flag as removed. I left
    the `tui_app_server` feature flag in place for now so its presence
    doesn't result in an error. It is simply ignored.
    
    Part 2 will rename the `tui_app_server` directory `tui`. I did this as
    two parts to reduce visible code churn.
  • updates: use brew api for version check (#10809)
    ## Problem
    
    `codex` currently prompts you to update via `brew upgrade --cask codex`
    but the brew api does not return the new version
    
    > <img width="1500" height="822" alt="Screenshot 2026-02-05 at 12 36
    09 PM"
    src="https://github.com/user-attachments/assets/9e12929d-95e8-43f4-8fba-ab93f5f76e73"
    />
    
    ## Solution
    
    `codex-rs/tui/src/updates.rs` was using the [latest cask in
    github](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/c/codex.rb)
    but this does not agree with the brew api, which leads to the issue
    above. Instead we use the [brew api json
    endpoint](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/c/codex.rb)
    to ensure our version check agrees with the upgrade command.
  • Allow enterprises to skip upgrade checks and messages (#7213)
    This is a feature primarily for enterprises who centrally manage Codex
    updates.
  • docs: Add --cask option to brew command to suggest (#5432)
    ## What
    - Add the `--cask` flag to the Homebrew update command for Codex.
    
    ## Why
    - `brew upgrade codex` alone does not update the cask, so users were not
    getting the right upgrade instructions.
    
    ## How
    - Update `UpdateAction::BrewUpgrade` in `codex-rs/tui/src/updates.rs` to
    use `upgrade --cask codex`.
    
    ## Testing
    - [x] cargo test -p codex-tui
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • fix terminal corruption that could happen when onboarding and update banner (#5269)
    Instead of printing characters before booting the app, make the upgrade
    banner a history cell so it's well-behaved.
    
    <img width="771" height="586" alt="Screenshot 2025-10-16 at 4 20 51 PM"
    src="https://github.com/user-attachments/assets/90629d47-2c3d-4970-a826-283795ab34e5"
    />
    
    ---------
    
    Co-authored-by: Josh McKinney <joshka@openai.com>
  • feat: Auto update approval (#5185)
    Adds an update prompt when the CLI starts:
    
    <img width="1410" height="608" alt="Screenshot 2025-10-14 at 5 53 17 PM"
    src="https://github.com/user-attachments/assets/47c8bafa-7bed-4be8-b597-c4c6c79756b8"
    />
  • 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.
  • Added CLI version to /status output (#3223)
    This PR adds the CLI version to the `/status` output.
    
    This addresses feature request #2767
  • Add a common way to create HTTP client (#3110)
    Ensure User-Agent and originator are always sent.
  • Fix release build (#2244)
    Missing import.
  • Set user-agent (#2230)
    Use the same well-defined value in all cases when sending user-agent
    header
  • check for updates (#1764)
    1. Ping https://api.github.com/repos/openai/codex/releases/latest (at
    most once every 20 hrs)
    2. Store the result in ~/.codex/version.jsonl
    3. If CARGO_PKG_VERSION < latest_version, print a message at boot.
    
    ---------
    
    Co-authored-by: easong-openai <easong@openai.com>