Repository navigation
Conversation
When authProfileIdSource is 'auto', the preferredProfile param was still passed to resolveAuthProfileOrder(), causing it to move the auto-selected profile (e.g., API key fallback) to the front of the candidate list. This bypassed the configured manual-first OAuth priority order. Also add higher-priority re-evaluation in resolveSessionAuthProfileOverride: when the current auto-selected profile is lower priority and a higher-priority profile has exited cooldown, switch back to it instead of staying pinned. Fixes openclaw#25510
Contributor
Author
|
Has merge conflicts — going to close and rebase if I still need this fix. |
|
@taw0002 running into similar things, is this still an issue for you? |
Contributor
Author
|
Yes just don't know if it's a priority and don't want to waste time if it isnt going to be reviewed and merged. I'll rebase and try one more time. |
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
Two related bugs in auth profile rotation that cause auto-selected fallback profiles (e.g., API key) to be used instead of higher-priority profiles (e.g., manual OAuth) even when those profiles are available.
Bug 1: preferredProfile passed for auto overrides (run.ts)
resolveAuthProfileOrder()receivedpreferredProfile: preferredProfileIdregardless of whether the source wasuserorauto. When set,resolveAuthProfileOrdermoves the preferred profile to the front of the candidate list. This means an auto-selectedanthropic:default(API key) gets front-of-queue treatment, bypassing manual OAuth profiles.Fix: Only pass
preferredProfilewhen the override source isuser(explicitly user-locked).Bug 2: No re-evaluation when higher-priority profiles exit cooldown (session-override.ts)
resolveSessionAuthProfileOverride()kept the current auto-selected profile as long as it wasn't in cooldown itself. It never checked whether a higher-priority profile had exited cooldown and become available again. So once the session fell back to API key, it stayed there until compaction or new session.Fix: Added a check — when the current auto-selected profile is not the highest priority in the configured order, scan for any higher-priority profile that's now available (not in cooldown) and switch to it.
Tests
session-override.test.ts:Fixes #25510
Greptile Summary
Fixes two related bugs in auth profile rotation that prevented higher-priority profiles (like manual OAuth) from being used when they became available again after cooldown periods.
run.tspreviously passedpreferredProfilefor bothuserandautooverride sources. This caused auto-selected profiles to get front-of-queue treatment viaresolveAuthProfileOrder, bypassing the configured priority order. Fixed by only passingpreferredProfilefor user-locked profiles.session-override.tsnever re-evaluated higher-priority profiles after they exited cooldown. Once a session fell back to a lower-priority profile (e.g., API key), it stayed there until compaction or new session. Fixed by adding logic to scan for available higher-priority profiles when the current profile is not the highest priority.Confidence Score: 5/5
lockedProfileId(user) vspreferredProfileId(user or auto) inrun.tsis now properly handled, and the re-evaluation logic insession-override.tsis straightforward with proper boundary checksLast reviewed commit: e064b4d