Commit Graph

8 Commits

  • Immutable CodexAuth (#8857)
    Historically we started with a CodexAuth that knew how to refresh it's
    own tokens and then added AuthManager that did a different kind of
    refresh (re-reading from disk).
    
    I don't think it makes sense for both `CodexAuth` and `AuthManager` to
    be mutable and contain behaviors.
    
    Move all refresh logic into `AuthManager` and keep `CodexAuth` as a data
    object.
  • chore: cleanup Config instantiation codepaths (#8226)
    This PR does various types of cleanup before I can proceed with more
    ambitious changes to config loading.
    
    First, I noticed duplicated code across these two methods:
    
    
    https://github.com/openai/codex/blob/774bd9e432fa2e0f4e059e97648cf92216912e19/codex-rs/core/src/config/mod.rs#L314-L324
    
    
    https://github.com/openai/codex/blob/774bd9e432fa2e0f4e059e97648cf92216912e19/codex-rs/core/src/config/mod.rs#L334-L344
    
    This has now been consolidated in
    `load_config_as_toml_with_cli_overrides()`.
    
    Further, I noticed that `Config::load_with_cli_overrides()` took two
    similar arguments:
    
    
    https://github.com/openai/codex/blob/774bd9e432fa2e0f4e059e97648cf92216912e19/codex-rs/core/src/config/mod.rs#L308-L311
    
    The difference between `cli_overrides` and `overrides` was not
    immediately obvious to me. At first glance, it appears that one should
    be able to be expressed in terms of the other, but it turns out that
    some fields of `ConfigOverrides` (such as `cwd` and
    `codex_linux_sandbox_exe`) are, by design, not configurable via a
    `.toml` file or a command-line `--config` flag.
    
    That said, I discovered that many callers of
    `Config::load_with_cli_overrides()` were passing
    `ConfigOverrides::default()` for `overrides`, so I created two separate
    methods:
    
    - `Config::load_with_cli_overrides(cli_overrides: Vec<(String,
    TomlValue)>)`
    - `Config::load_with_cli_overrides_and_harness_overrides(cli_overrides:
    Vec<(String, TomlValue)>, harness_overrides: ConfigOverrides)`
    
    The latter has a long name, as it is _not_ what should be used in the
    common case, so the extra typing is designed to draw attention to this
    fact. I tried to update the existing callsites to use the shorter name,
    where possible.
    
    Further, in the cases where `ConfigOverrides` is used, usually only a
    limited subset of fields are actually set, so I updated the declarations
    to leverage `..Default::default()` where possible.
  • cloud: status, diff, apply (#7614)
    Adds cli commands for getting the status of cloud tasks, and for
    getting/applying the diffs from same.
  • fix(cloud-tasks): respect cli_auth_credentials_store config (#5856)
    ## Problem
    
    `codex cloud` always instantiated `AuthManager` with `File` mode,
    ignoring the user's actual `cli_auth_credentials_store` setting. This
    caused users with `cli_auth_credentials_store = "keyring"` (or `"auto"`)
    to see "Not signed in" errors even when they had valid credentials
    stored in the system keyring.
    
    ## Root cause
    
    The code called `Config::load_from_base_config_with_overrides()` with an
    empty `ConfigToml::default()`, which always returned `File` as the
    default store mode instead of loading the actual user configuration.
    
    ## Solution
    
    - **Added `util::load_cli_auth_manager()` helper**  
    Properly loads user config via
    `load_config_as_toml_with_cli_overrides()` and extracts the
    `cli_auth_credentials_store` setting before creating `AuthManager`.
    
    - **Updated callers**  
      - `init_backend()` - used when starting cloud tasks UI
      - `build_chatgpt_headers()` - used for API requests
    
    ## Testing
    
    -  `just fmt`
    -  `just fix -p codex-cloud-tasks`
    -  `cargo test -p codex-cloud-tasks`
    
    ## Files changed
    
    - `codex-rs/cloud-tasks/src/lib.rs`
    - `codex-rs/cloud-tasks/src/util.rs`
    
    ## Verification
    
    Users with keyring-based auth can now run `codex cloud` successfully
    without "Not signed in" errors.
    
    ---------
    
    Co-authored-by: Eric Traut <etraut@openai.com>
    Co-authored-by: celia-oai <celia@openai.com>
  • [Auth] Choose which auth storage to use based on config (#5792)
    This PR is a follow-up to #5591. It allows users to choose which auth
    storage mode they want by using the new
    `cli_auth_credentials_store_mode` config.
  • cloud: codex cloud exec (#5060)
    By analogy to `codex exec`, this kicks off a task in codex cloud
    noninteractively.
  • Support CODEX_API_KEY for codex exec (#4615)
    Allows to set API key per invocation of `codex exec`
  • Add cloud tasks (#3197)
    Adds a TUI for managing, applying, and creating cloud tasks