fix(auth): resync copied Codex profile tokens - #41705
Closed
TigerkidYang wants to merge 1 commit into
Closed
Conversation
Contributor
|
Thanks for the focused Codex regression coverage. The global-pool fallback portion remains needed: current Problems
Suggested changes
Automated hermes-sweeper review. |
14 tasks
Author
|
Closing this PR because current main has since adopted the canonical global-root/write-through architecture for Codex OAuth, while the remaining narrow fallback fix is already covered by #34141. The sibling-profile token scan in this PR no longer matches the repository’s profile-isolation model. Thanks for the review. |
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
Fixes a Codex auth failure mode where copied or cloned Hermes profiles can keep spending a stale single-use Codex refresh token even after a sibling profile has already rotated it.
This PR does two related things:
credential_pool.openai-codexthroughread_credential_pool(...), so named profiles with an empty local Codex singleton/pool can still use the global-root credential pooldevice_codeandmanual:device_code) to adopt a matching, fresher sibling profile pool entry before refreshing, instead of calling the token endpoint with an already-consumed refresh tokenThe sibling resync is intentionally narrow: it only matches the same pool entry
idandsource, requires non-empty access/refresh tokens, skips identical refresh tokens, and avoids rolling backward when both entries havelast_refreshtimestamps.Related issues / PRs
Fixes #6653
Refs #34143
Complements #34141. That PR fixes the global-pool runtime fallback; this PR includes that same fallback behavior and adds the copied-profile refresh-token resync path that caused the gateway profiles in #6653 to keep falling over after one profile refreshed successfully.
Type of change
Test plan
Passed locally on Windows with Python 3.11:
I also tried the repository wrapper:
but from this Windows checkout it selected
/home/runchangyang/.hermes/hermes-agent/venv/bin/python, whose environment is missingpytest. I treated that as a local WSL runner environment issue and validated with the direct.venvpytest commands above.