Repository navigation
Conversation
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.
ELI5
A saved Claude account you are not using right now still has a real "used X% of this 5-hour window" number, and that number stays true until the window resets. Orca was throwing it away after 30 minutes (a rule made for the account you are actively using), so a saved account went blank on the first hiccup. Now the number stays until the window actually resets, and a window that has reset shows as unknown instead of an old percentage.
What Changed
claude-usage-window-expiry.ts:expireClaudeUsageWindows(limits, now)nulls each ofsession/weekly/fableWeeklywhoseresetsAthas passed; a window without a reset time is bounded by its ownwindowMinutesfromupdatedAt. Returns the same object when nothing expired.service-result-policy.ts:applyInactiveClaudeStalePolicy. For inactive Claude accounts, a failure with a transientfailureKindkeeps the previous windows that are still ahead of their reset (no 30-minute cutoff) and reports the failure on the row;missing-credentialsdrops them so the row can ask for a sign-in; a failure without afailureKindkeeps the generic 30-minute policy, because onmainthe inactive "No credentials" result is unclassified.applyStalePolicyis unchanged for the active bar and for Codex. The same file schedules one state publish at the next window reset, so the row updates while the app is unfocused.service-inactive-accounts.ts: the inactive-Claude call site uses the new policy and schedules that publish.service-state.ts/service-configuration.ts:buildInactiveArraytakes an optional projection; the Claude list is published throughexpireClaudeUsageWindows, so a reset window reads as unknown even with no fetch in between.No persistence: the cache is still process memory. That was a deliberate trade after discussion — with a working token refresh and #18746 the gap after a restart is seconds, not days, so the disk write was not worth its own failure modes.
Why
Point 4 of #14833: "Keep last-known until that window's
resetsAt. After reset, show unknown. Do not blank the row at an arbitrary 30 minutes." The 30-minute rule protects the active bar from showing a stale number when the statusline feed goes quiet; an inactive account has no feed, so the only thing that invalidates its number is the window resetting.Linked Issue
Part of #14833 (point 4). Does not close it.
Visual Proof
N/A: same rows, same bars; only how long a number is kept changes. Behavior is covered by the service tests below.
Testing
Platforms: Windows 11 (local). Main-process only, platform-neutral.
New unit tests (
claude-usage-window-expiry.test.ts, 4 cases): untouched object when nothing expired; only the reset window dropped; no-resetsAtwindow bounded by its length; Fable weekly handled like the others.New service tests (
service-inactive-account-previews.test.ts, fake timers): a transient failure two hours after a good fetch keeps the session window (reset still ahead) and drops the weekly one (reset passed);missing-credentialsdrops the kept windows; an unclassified failure keeps the 30-minute policy; a thrown fetch keeps the cache but a window past its reset disappears fromgetState()with no new fetch.Touched test files: 22 passed, 1 failed. The failure,
allows usage-panel Fable supplements for inactive Claude account previews, fails the same way on an untouchedmain(de8bffe).pnpm test src/main/rate-limits: 709 passed, 10 failed; the same 10 fail on an untouchedmain(Windows-only environment: usage-panel/PTY fallback, Codex RPC, OpenCode XDG).pnpm tc:node: clean.oxlinton the 7 files andcheck:code-quality:changed: clean.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implementation and tests by Claude (Fable 5.1) via Claude Code, driven and verified by me.
Review
Agent code-review summary:
nullwhere it used to be a stale object.applyStalePolicy.inactiveClaudeAccounts; benefits from the longer retention and never sees a reset window's stale percentage.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Rebuilt on
mainon 2026-10-02 without the stack. Until a producer classifies inactive-preview failures (#18736 or #24365), the visible effect is that a window's numbers disappear at its reset instead of outliving it after a thrown fetch. If #24365 lands, its new catch-path error row should go throughapplyInactiveClaudeStalePolicy.Remaining for #14833 after this: per-account rows in the Usage popover (the Accounts pane stays with #10688).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author
X: @EnricoPin