Skip to content

fix(auth): keep Codex OAuth pool accounts distinct - #32664

Closed
glesperance wants to merge 1 commit into
NousResearch:mainfrom
glesperance:fix/codex-auth-pool-entries
Closed

fix(auth): keep Codex OAuth pool accounts distinct#32664
glesperance wants to merge 1 commit into
NousResearch:mainfrom
glesperance:fix/codex-auth-pool-entries

Conversation

@glesperance

@glesperance glesperance commented May 26, 2026

Copy link
Copy Markdown
Contributor

Rationale

hermes auth add openai-codex must preserve independently added Codex OAuth accounts. The bug this guards against is a second login collapsing earlier pool entries into the latest account, so credential rotation appears configured but repeatedly uses the same account.

Summary

  • Adds a shared SOURCE_MANUAL_DEVICE_CODE constant for manually added device-code credentials.
  • Uses that constant when adding Codex OAuth credentials so the add path remains explicit and does not drift back to the singleton device_code source.
  • Adds regression coverage for adding two distinct Codex OAuth accounts and reloading the pool without collapsing them.

Test Plan

  • python -m pytest tests/hermes_cli/test_auth_commands.py::test_auth_add_codex_oauth_persists_pool_entry tests/hermes_cli/test_auth_commands.py::test_auth_add_codex_oauth_keeps_distinct_pool_accounts -q
  • python -m pytest tests/hermes_cli/test_auth_commands.py -q
  • python -m ruff check agent/credential_pool.py hermes_cli/auth_commands.py tests/hermes_cli/test_auth_commands.py
  • git diff --check

@glesperance glesperance changed the title test(auth): cover distinct Codex OAuth pool entries fix(auth): keep Codex OAuth pool accounts distinct May 26, 2026
@glesperance
glesperance force-pushed the fix/codex-auth-pool-entries branch from b0448e3 to 769ce3a Compare May 26, 2026 15:10
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard labels May 26, 2026
@teknium1

teknium1 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Merged via #42316. Your SOURCE_MANUAL_DEVICE_CODE constant and the direction of this PR — making hermes auth add openai-codex keep accounts distinct rather than collapsing them into the singleton — are exactly what we shipped, with you credited as co-author on the add-path commit (c78b3e1 on main, Co-authored-by: glesperance).

The literal diff here couldn't be cherry-picked cleanly because the Codex add block in auth_commands.py was rewritten on main since this branched (it now routes through _save_codex_tokens). So we reimplemented your intent against current code: a distinct PooledCredential per account via pool.add_entry(), matching the xai/gemini/qwen patterns, plus mark_provider_active_if_unset() so the first add still sets the active provider. Your regression test (two distinct accounts stay distinct) is in the merged suite. Thanks!

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

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants