Skip to content

fix(codex/azure): remove conflicting requires_openai_auth from Azure preset#2738

Open
wh9204 wants to merge 1 commit into
farion1231:mainfrom
wh9204:fix/codex-azure-remove-requires-openai-auth
Open

fix(codex/azure): remove conflicting requires_openai_auth from Azure preset#2738
wh9204 wants to merge 1 commit into
farion1231:mainfrom
wh9204:fix/codex-azure-remove-requires-openai-auth

Conversation

@wh9204
Copy link
Copy Markdown

@wh9204 wh9204 commented May 12, 2026

Problem

The Azure OpenAI preset in codexProviderPresets.ts ships with both:

  • env_key = "OPENAI_API_KEY" (env-variable auth)
  • requires_openai_auth = true (OpenAI OAuth login)

These two fields are mutually exclusive per the Codex config reference:

Do not combine with env_key, experimental_bearer_token, or requires_openai_auth.

When a user follows the README and sets OPENAI_API_KEY, Codex still errors out with Missing environment variable: OPENAI_API_KEY. — because requires_openai_auth = true makes Codex demand an OpenAI OAuth login flow and ignore the env-key auth path.

Fix

Remove the conflicting requires_openai_auth = true line from the Azure preset. Azure OpenAI authenticates via API key (env_key), not OpenAI OAuth.

Verification

  • Generated config now matches the Microsoft Learn canonical Azure setup.
  • Setting OPENAI_API_KEY env var and running codex connects to Azure OpenAI successfully (reproduced on Windows 10, Codex v0.130.0, model gpt-5.5).

Scope

Intentionally minimal — only the Azure preset is touched. Some third-party presets generated by generateThirdPartyConfig() may have the same conflict, but each needs case-by-case verification and is out of scope for this fix.

Related: #1309 (broader Azure compatibility PR, but does not modify this file).

…preset

The Azure OpenAI preset shipped both `env_key = "OPENAI_API_KEY"` and
`requires_openai_auth = true`, which are mutually exclusive auth
mechanisms per the Codex config reference:
https://developers.openai.com/codex/config-reference

> Do not combine with `env_key`, `experimental_bearer_token`, or
> `requires_openai_auth`.

With both set, Codex ignores the env-key path and demands an OpenAI
OAuth login, so users following the README and setting `OPENAI_API_KEY`
still see `Missing environment variable: OPENAI_API_KEY.`

Azure OpenAI authenticates via API key (env_key), not OpenAI OAuth, so
remove the conflicting line. The generated config now matches the
canonical Microsoft Learn Azure setup.
@farion1231
Copy link
Copy Markdown
Owner

@codex review
@claude review

@claude
Copy link
Copy Markdown

claude Bot commented May 12, 2026

Claude finished @farion1231's task in 36s —— View job


Review

LGTM. No blocking issues.

The fix is correctly scoped. Per the Codex config reference, env_key and requires_openai_auth are mutually exclusive, and the Azure preset was the only entry in src/config/codexProviderPresets.ts that set both. Removing requires_openai_auth = true at line 113 resolves the auth conflict without affecting any other preset:

  • Other third-party presets generated by generateThirdPartyConfig() (line 62) emit requires_openai_auth = true but do not set env_key, so they are not in the same conflicting state. The author's decision to leave them alone is correct.
  • E-FlowCode (line 419) and PIPELLM (line 458) follow the same requires_openai_auth-without-env_key pattern — also out of scope.
  • The auth path is unchanged: auth.json still carries OPENAI_API_KEY via generateThirdPartyAuth(""), which Codex reads through the env_key reference in the TOML.

The generated TOML now matches the Microsoft Learn canonical Azure setup cited in the PR description.

Tasks

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants