Skip to content

fix(auth): preserve named-provider headers in auxiliary calls - #91156

Draft
azilko wants to merge 1 commit into
NousResearch:mainfrom
azilko:codex/aux-provider-headers
Draft

fix(auth): preserve named-provider headers in auxiliary calls#91156
azilko wants to merge 1 commit into
NousResearch:mainfrom
azilko:codex/aux-provider-headers

Conversation

@azilko

@azilko azilko commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • preserve the Codex User-Agent and originator headers when a named custom provider targets chatgpt.com
  • apply providers.<name>.extra_headers to the auxiliary OpenAI client, matching the main-agent construction path
  • keep header precedence explicit: host defaults, global user defaults, then provider-specific headers

Why

Named custom providers already support command-backed credentials, and the main runtime applies both Codex host headers and provider-specific headers. The auxiliary named-provider branch did neither. A provider could therefore work for normal turns while title generation, compression, vision, or other auxiliary calls failed with 401/403 responses.

Header values are never logged.

Tests

  • scripts/run_tests.sh tests/agent/test_auxiliary_named_custom_providers.py tests/agent/test_auxiliary_user_default_headers.py tests/agent/test_codex_cloudflare_headers.py -q — 32 passed
  • python -m ruff check agent/auxiliary_client.py tests/agent/test_auxiliary_named_custom_providers.py — clean
  • git diff --check upstream/main...HEAD — clean

Overlap and exact delta

Open PRs #61346, #84223, and #88474 cover adjacent named-provider header plumbing. This draft should be reviewed as the narrower auxiliary Codex-host follow-up: it adds the ChatGPT/Codex User-Agent and originator defaults and makes the auxiliary precedence chain explicit (host defaults, global user defaults, provider-specific headers). If an older auxiliary PR lands first, this branch should be rebased and reduced to that remaining delta.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: this overlaps the active auxiliary-header fixes #61346, #84223, and #88474. This PR additionally handles ChatGPT/Codex host defaults in the named-provider construction path; reviewers should consolidate the overlapping routes.

@azilko

azilko commented Aug 20, 2026

Copy link
Copy Markdown
Author

Thanks — agreed on the overlap. #91156 was intentionally scoped to the current command-backed named-provider path on chatgpt.com, including the Codex host defaults (User-Agent and originator) in addition to the selected provider's extra_headers.

I'm happy to consolidate that hunk and its command-backed Codex regression test into whichever generic auxiliary-header PR maintainers select. Of the linked implementations, #84223 appears to provide the broadest named-identity and async coverage; the Codex-specific test here can complement it by pinning the key_cmd + codex_responses + ChatGPT-host behavior.

@azilko

azilko commented Aug 21, 2026

Copy link
Copy Markdown
Author

Overlap audit against the three older open PRs:

So this should not be merged as though the whole header-plumbing premise were novel. I have narrowed the PR description to call out the overlap and the exact delta. If one of the older auxiliary PRs lands first, I will rebase and retain only the missing Codex-host default/precedence behavior and its tests.

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

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants