Skip to content

Add per-account custom User-Agent override for OpenAI OAuth accounts - #6294

Open
JnyRoad wants to merge 2 commits into
Wei-Shaw:mainfrom
JnyRoad:feat/codex-ua-fingerprint-diversity
Open

Add per-account custom User-Agent override for OpenAI OAuth accounts#6294
JnyRoad wants to merge 2 commits into
Wei-Shaw:mainfrom
JnyRoad:feat/codex-ua-fingerprint-diversity

Conversation

@JnyRoad

@JnyRoad JnyRoad commented Aug 27, 2026

Copy link
Copy Markdown

Summary

  • Add an optional per-account custom User-Agent field on the OpenAI OAuth account edit form, mirroring the existing plan_type manual-override pattern: a non-empty value overrides the global openai_codex_user_agent setting for that one account (only contributing client name/OS/arch/terminal — originator/version are still reconstructed by the existing resolveCodexOutboundIdentity logic, untouched by this change); clearing it removes the user_agent credential key and falls back to the global setting.
  • An earlier revision of this PR also auto-assigned a per-account UA from a built-in pool on account creation. That was dropped: it made the account-level credential permanently non-empty, which silently overrode the global openai_codex_user_agent setting for every newly created account (account-level always wins over global in resolveCodexOutboundIdentity). A single global UA governing all accounts, with this manual per-account override as the only exception, is the intended behavior.

Test plan

  • go build ./... and go vet ./... clean
  • go test ./internal/service/... — full package, 0 failures
  • Frontend: vitest run — 246 files / 1771 tests, 0 failures
  • TDD red→green cycle explicitly verified for the edit-form tests (reverted implementation, confirmed tests fail, restored, confirmed pass)

🤖 Generated with Claude Code

New OpenAI OAuth accounts left without a custom User-Agent used to
share one hardcoded UA constant across every account, making all
outbound Codex traffic look identical regardless of the underlying
ChatGPT account. Assign each account a deterministic (OS;arch)+
terminal combination from a built-in pool, keyed by account ID, on
creation only; existing accounts are unaffected unless edited.

Also expose a per-account custom User-Agent field on the OpenAI OAuth
edit form, mirroring the existing plan_type override pattern: non-empty
overrides the pool assignment, clearing it removes the credential key.
originator/version reconstruction is untouched — both paths only ever
produce the (OS;arch)+terminal segment of the UA string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

Per-account automatic User-Agent assignment on account creation
conflicted with the existing global `openai_codex_user_agent` setting:
once an account had a non-empty credentials.user_agent, the account
level value always took priority over the global one in
resolveCodexOutboundIdentity, silently making the global setting
ineffective for any account created after this landed.

Keep a single global UA as the source of truth, with the per-account
manual override on the edit form (added earlier in this branch) as the
only supported per-account exception.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@JnyRoad JnyRoad changed the title Diversify OpenAI Codex OAuth outbound User-Agent fingerprint Add per-account custom User-Agent override for OpenAI OAuth accounts Aug 27, 2026
@JnyRoad

JnyRoad commented Aug 28, 2026

Copy link
Copy Markdown
Author

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign, please reply with the following comment:

I have read the CLA Document and I hereby sign the CLA

You only need to sign once — it will be valid for all your future contributions to this project.

I have read the CLA Document and I hereby sign the CLA

You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

I have read the CLA Document and I hereby sign the CLA

@JnyRoad

JnyRoad commented Aug 28, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 participant