fix(auth): fall back from empty codex profile state - #38273
Open
sweetcornna wants to merge 1 commit into
Open
Conversation
sweetcornna
marked this pull request as ready for review
June 3, 2026 15:15
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for narrowing this to the credential-store shadowing path. The current-main inspection confirms the reported gap: an empty profile singleton shadows global state, while the Codex pool fallback reads only the profile pool.
Problems
hermes_cli/auth.py:1157returns a global Codex state without preserving its source store. A later refresh reaches_save_codex_tokens, which reloads and writes the active profile store (hermes_cli/auth.py:3386-3407), leaving the global source stale. Current main’s Nous path uses_load_provider_state_with_source/_save_provider_state_to_sourcefor this cross-store rotation case (hermes_cli/auth.py:1177-1252).- The added tests do not force a refresh of a global fallback state, so they do not cover that persistence invariant.
Suggested changes
- Salvage this against the source-aware helper on current main and write refreshed Codex grants back to the store they were read from.
- Add a profile/global forced-refresh regression asserting global rotation and no unintended profile shadowing.
Automated hermes-sweeper review.
| @@ -1143,6 +1157,18 @@ def _load_provider_state(auth_store: Dict[str, Any], provider_id: str) -> Option | |||
| if isinstance(providers, dict): | |||
Contributor
There was a problem hiding this comment.
This fallback loses the auth-store source. If the returned global token is expiring, the Codex refresh path later saves via _save_codex_tokens to the active profile store, leaving the global grant stale. Please carry the selected source path through refresh and persist back to that source, following current main’s _load_provider_state_with_source / _save_provider_state_to_source pattern.
14 tasks
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.
Summary
Scope
This addresses the credential-store shadowing part of #38261. The stale worker credential lifecycle described there is a separate launchd/gateway worker restart problem and is intentionally left for a follow-up lifecycle/docs change.
Addresses #38261.
Verification