openai / openai/codex

codex --profile silently falls back when profile file is missing

Open
#40,279 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI code-review config
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Symptom

Selecting a profile whose standalone config file does not exist is silently ignored. Codex continues with the base user configuration, runs the review, and exits 0.

The startup preamble makes the fallback visible only after the fact:

model: gpt-5.6-sol
provider: openai

This is dangerous for automation that uses named profiles to select a provider/model or enforce a cost boundary.

Repro

Environment:

  • Codex CLI 0.149.0
  • macOS
  • base user config selects the OpenAI provider/model
  • $CODEX_HOME/aut500-profile-does-not-exist.config.toml does not exist

From a clean Git repository:

codex -p aut500-profile-does-not-exist review --base main
echo "$?"

Observed:

  • no missing-profile error or warning
  • base provider/model selected
  • review runs normally
  • exit status 0

Expected:

  • a non-zero configuration error naming the missing profile file, or an explicit opt-in fallback flag

Why this matters

A caller cannot safely use --profile as a routing contract. A typo, incomplete machine setup, or deleted profile can silently spend a different quota and produce evidence under the wrong model/provider.

Suggested fixes

Fail closed when an explicitly named profile file does not exist. If backward compatibility requires fallback, emit a machine-detectable warning and provide a strict-profile option.

Discovered

While validating Touchstone local-review profile routing on 2026-08-23.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied codex -p aut500-profile-does-not-exist review --base main reproduction and inspect the profile-loading path used by the CLI. Trace how a missing standalone profile is handled and verify the behavior for an explicitly named profile. Done means the command reports a non-zero configuration error naming the missing file, or fallback is explicitly opted into and machine-detectable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.