fix(auxiliary): refresh auto-routed Copilot credentials - #20978
Closed
LeonSGP43 wants to merge 1 commit into
Closed
Conversation
Collaborator
Contributor
|
Closing — the auto-routed Copilot credential refresh landed via PR #59837 (salvage of #20837 by @fanyangCS, the earlier submission of the same fix). The merged version infers the backend from the client base URL, covering Copilot/Codex/Anthropic/Nous auto routes. Thanks for the contribution! |
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 #20832.
When auxiliary routing is configured as
provider: auto, Hermes can still resolve the actual selected client to Copilot. If the short-lived Copilot IDE/API token expires, the existing auth retry path sees onlyresolved_provider == "auto", skips provider-specific refresh, and can keep reusing a stale cached auto client.This PR keeps the fix narrow:
base_urlexchange_copilot_token()autoroute cache when the concrete refresh provider differs from the route providermain_runtimethrough the same cache/refresh path as sync callsHTTP 401: ... unauthorizedtext as an auth error, even when an SDK exception does not exposestatus_codeVerification
scripts/run_tests.sh tests/agent/test_auxiliary_client.py -k "is_auth_error or auto_routed_copilot or refresh_provider_credentials_refreshes_copilot or refreshes_codex_on_401 or refreshes_anthropic_on_401 or retries_nous_after_401"-> 11 passed, 4 warningsscripts/run_tests.sh tests/agent/test_auxiliary_client.py-> 138 passed, 4 warningsgit diff --checkNon-goals