Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change tracks when Claude usage enters a transient sign-in refresh failure. It preserves that timestamp across rate-limit polling and escalates the state after two minutes. Escalated states use “Sign-in needs refresh” status text, re-authentication guidance, and a sign-in roster row. Tests cover timestamp handling, escalation boundaries, renderer output, and repeated polling. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change provides the intended sign-in recovery guidance after persistent Claude usage-refresh failures without an identified merge-blocking regression. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/shared/claude-refreshing-sign-in.ts (1)
4-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
isClaudeRefreshingFailureKindfromCLAUDE_REFRESHING_FAILURE_KINDSinstead of duplicating the literals.The type guard re-hardcodes the same three strings already enumerated in
CLAUDE_REFRESHING_FAILURE_KINDS. If the array is ever updated, this function can silently drift out of sync.♻️ Proposed fix
export function isClaudeRefreshingFailureKind( kind: UsageRateLimitFailureKind | undefined ): kind is ClaudeRefreshingFailureKind { - return ( - kind === 'stale-token' || - kind === 'refreshable-credentials-without-token' || - kind === 'delegated-refresh-required' - ) + return kind != null && (CLAUDE_REFRESHING_FAILURE_KINDS as readonly string[]).includes(kind) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e9187982-6c8e-41b7-95b5-9a9c3e9834df
📒 Files selected for processing (8)
src/main/rate-limits/service.tssrc/renderer/src/components/status-bar/repro-8974-refreshing-sign-in-stuck.test.tssrc/renderer/src/components/status-bar/usage-error-copy.tssrc/renderer/src/components/status-bar/usage-roster-row-state.test.tssrc/renderer/src/components/status-bar/usage-roster-row-state.tssrc/shared/claude-refreshing-sign-in.test.tssrc/shared/claude-refreshing-sign-in.tssrc/shared/rate-limit-types.ts
70317a4 to
d81a3c3
Compare
…eout Claude usage can sit forever on soft "Refreshing sign-in" copy when OAuth repair keeps failing while the CLI session still works. Stamp the first refreshing failure time across polls and escalate status-bar/roster copy to a re-auth CTA after 2 minutes so the chip cannot look stuck indefinitely. Fixes stablyai#8974
Replace hand-typed auto.* descriptive keys with file-path SHA keys so localize-renderer-strings stays consistent; catalog the English strings.
d81a3c3 to
41d8a95
Compare
Sync update (
|
|
Thanks @innocarpe for the work here. Closing as superseded: Orca no longer refreshes Claude tokens itself (#26801), so the stuck 'Refreshing sign-in' state this escalates no longer exists. Appreciate the contribution, and feel free to open a fresh PR against current main if you see anything still missing. |

Description
User-facing: Claude usage in the status bar could sit forever on “Refreshing sign-in” even when the terminal Claude session was fine and usage never came back. After this change, the soft “refreshing” state is kept only while repair is in flight; if it stays stuck for 2 minutes, the chip escalates to “Sign-in needs refresh” and the roster offers a re-auth CTA.
Technical: stamp a stable
usageMetadata.refreshingSinceMsacross continuous Claudestale-token/refreshable-credentials-without-token/delegated-refresh-requiredfailures inapplyStalePolicy, then escalate label/message/roster kind once that stamp ages pastCLAUDE_REFRESHING_SIGN_IN_ESCALATE_AFTER_MS.Fixes #8974
Impact / ELI5
Orca tries to refresh Claude’s usage OAuth in the background. Sometimes that refresh never succeeds, but the soft wording still said “we’re refreshing…” forever — like a loading spinner that never ends. Now we give the soft spinner a short time window; if it doesn’t finish, we tell you clearly that you need to re-authenticate for usage tracking (your agent in the terminal may still work).
Root cause
getProviderUsageStatusLabel/getProviderUsageErrorMessagemap these ClaudefailureKinds to permanent soft copy:stale-tokenrefreshable-credentials-without-tokendelegated-refresh-requiredThere was no age/timeout escalation. The main fetcher can keep re-emitting those kinds on every poll (
updatedAtmoves, but the semantic state stays “refreshing”), so the UI never leaves the spinner. Live Claude CLI sessions can remain healthy on a different credential surface while usage tracking is stuck.Reproduction kit (handoff):
docs/bug-reproductions/8974.mdonnwparker/bug-repro-handoffs.Fix
src/shared/claude-refreshing-sign-in.ts— stamp/preserverefreshingSinceMs, escalate predicate (2 min)UsageRateLimitMetadata.refreshingSinceMs?: numberapplyStalePolicyalways runsstampClaudeRefreshingSinceso continuous error polls keep the first stampkind: 'sign-in'with re-auth CTABehavior matrix
error(soft)sign-in(CTA)status: 'ok')Evidence
pnpm exec vitest run --config config/vitest.config.ts \ src/shared/claude-refreshing-sign-in.test.ts \ src/renderer/src/components/status-bar/repro-8974-refreshing-sign-in-stuck.test.ts \ src/renderer/src/components/status-bar/usage-roster-row-state.test.ts \ src/renderer/src/components/status-bar/tooltip.test.tsResult: 57/57 passed (local).
Key tests:
User-regression-tradeoffs
deferred-by-live-session(“Waiting for Claude session”).Checklist notes
translate()with English fallbacks (same pattern as nearby status-bar keys).AI review summary
ELI5
Claude usage in the status bar could sit on "Refreshing sign-in" forever. After two minutes of no progress it escalates to "Sign-in needs refresh" and offers a re-auth action instead of spinning forever.