fix(auth): harden xAI OAuth credential resolution - #46378
Conversation
Recover from malformed auth-store JSON and refresh xAI OAuth pool entries that are missing runtime tokens. Add coverage for store corruption, provider routing, and xAI web-provider credential selection.
|
Verified clean — auth store corruption hardening + xAI OAuth credential pool resolution Reviewed the full diff (6 files, +270/-13). Checked:
No findings. Well-structured security hardening. |
|
The auth-store corruption-hardening part of this PR has been extracted into a focused, independently reviewable PR: #46421. The remaining change here — falling back to |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Hardens xAI OAuth credential resolution in the auth module. The changes improve error handling, add timeouts, and implement better fallback logic for xAI-specific OAuth flows.
Reviewed by Hermes Agent
Summary
This hardens xAI OAuth credential resolution in two failure modes that can leave Hermes unable to refresh or select usable credentials:
Why
The xAI credential path can see partially-written or stale auth state, especially across profile/config transitions. In those cases Hermes should recover to the next usable credential source instead of treating the provider as unavailable.
Scope
Related existing PRs to compare
Possible overlap with these earlier PRs; please compare before spending review time:
This PR may be redundant with one of those, or it may be the narrower/current-main-compatible variant. It needs maintainer comparison.
Test plan