fix(auth): propagate credential label to pool entries on re-auth - #42110
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(auth): propagate credential label to pool entries on re-auth#42110liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
When a user runs `hermes auth add openai-codex` (or any OAuth provider), the computed label was saved to auth.json providers state but never propagated to credential_pool entries. Two bugs caused this: 1. `_sync_codex_pool_entries()` synced tokens and error markers but not the label field, leaving pool entries with stale labels. 2. `_upsert_entry()` unconditionally skipped label updates when the existing entry already had a label, preventing the label from being refreshed even when the user explicitly provided `--label` or the auto-generated label incremented (e.g., oauth-1 → oauth-2). Fixes NousResearch#42102
1 task
19 tasks
tonydwb
approved these changes
Jun 9, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Looks Good
- Fixes credential label propagation: ensures the label is passed to
_sync_codex_pool_entrieswhen re-authenticating, so pool entries reflect the correct label. - Dedicated test covers the re-auth propagation case.
- No security concerns, no debug artifacts.
Reviewed by Hermes Agent
Contributor
|
Thanks for the focused regression work. Automated hermes-sweeper review found that current
Closing as implemented on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes credential label not updating on re-auth for
hermes auth add openai-codex(and other OAuth providers). When a user re-authenticates, the computed label (e.g.,openai-codex-oauth-2) was saved to auth.json but never propagated to the credential pool, so the entry kept its stale label (e.g.,openai-codex-oauth-1). The--labelflag was similarly ignored for existing entries.Related Issue
Fixes #42102
Type of Change
Changes Made
agent/credential_pool.py: In_upsert_entry(), changed label skip logic from "skip if existing has any label" to "skip only if new label equals existing label". This allows label updates when re-authentication produces a different label.hermes_cli/auth.py: Addedlabelparameter to_sync_codex_pool_entries()and propagated it to pool entries alongside token updates. Updated_save_codex_tokens()to pass the label through.tests/hermes_cli/test_auth_codex_provider.py: Added 4 regression tests covering label sync to pool, custom--labelpropagation, label update on difference, and label preservation when unchanged.How to Test
pytest tests/hermes_cli/test_auth_codex_provider.py -v— all 28 tests pass (24 existing + 4 new)pytest tests/agent/test_credential_pool.py -v— all 78 tests pass (no regression from_upsert_entrychange)pytest tests/hermes_cli/test_auth_commands.py -v— all 49 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
agent/credential_pool.py::_upsert_entry(callers: ~15 via_seed_from_singletons,_seed_from_env)hermes_cli/auth.py::_sync_codex_pool_entries(callers: 1 —_save_codex_tokens)_upsert_entryis used by all pool seeding paths (anthropic, nous, xai, env-seeded). The label change is safe because re-authentication always produces a valid label.