Fix/58498 status card oauth usage clean#1810
Open
BingqingLyu wants to merge 6 commits into
Open
Conversation
added 6 commits
April 2, 2026 02:37
…rd-oauth-usage-clean # Conflicts: # src/infra/provider-usage.auth.ts
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.
fixes [Bug]: Status card shows the active OAuth profile, but weekly usage appears to reflect a different Oauth credential openclaw/openclaw#58498
Summary
Fix the status card so the usage/quota line is resolved with the same OAuth profile shown as active for the current session.
Previously, when multiple OAuth profiles existed under the same provider, the status surface could display the correct active profile from authProfileOverride while weekly
usage was still loaded from a different profile chosen by provider-level fallback order. This made the auth label and usage summary inconsistent.
This PR threads the session’s active OAuth profile into provider usage resolution and prefers it when loading usage-backed status output.
It also adds a guard so a preferred profile is only used when it actually belongs to the requested provider. If the override is stale or mismatched, usage resolution falls back
to the normal provider-scoped order.
Root Cause
The status card already respected sessionEntry.authProfileOverride when rendering the active auth label, but provider usage loading resolved credentials only at the provider
level.
That meant:
If the session override was stale or mismatched, the preferred profile could also be incorrectly tried for the wrong provider.
Changes
Files Changed
Behavior After This Change
Testing
Intended targeted tests:
pnpm vitest run \
src/infra/provider-usage.auth.normalizes-keys.test.ts \
src/infra/provider-usage.load.test.ts \
src/agents/openclaw-tools.session-status.test.ts