Repository navigation
Conversation
The accounts.subscribe snapshot already carries refreshed rate-limit usage after switching the active Claude/Codex account on a paired remote server, but AccountsPane discarded the field instead of pushing it into the shared store, so the bottom-left usage meter kept showing the outgoing account's numbers. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UPMdb1h2Ens95YLBgjSFRK
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to Switching back to the local account can temporarily show remote usage or use a remote runtime target. Reload local rate limits on the local snapshot. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the bug, affected remote path, fix, and tests, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Update the description to use the repository template. Add a linked issue after “Fixes #”, provide visual proof or write “N/A” with a reason, complete the required testing and checklist sections, and include the required review, boundary, notes, and AI disclosure information as applicable.
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.
Important
The fix wholesale-replaces the renderer's shared rate-limit store with the remote snapshot, clobbering desktop-local provider usage. Only claude/codex are remote-scoped; the other providers are fetched from the desktop's own local credentials and get wiped on every snapshot.
Reviewed changes
- Apply
snapshot.rateLimitsinAccountsPane— theonSnapshothandler now callssetRateLimitsFromPush(snapshot.rateLimits)when the field is present, and adds the action to the effect's dependency array. - New
AccountsPane.remote-rate-limit-snapshot.test.tsx— covers a remote snapshot with populatedrateLimitsupdating the store and a local snapshot withrateLimits: nullleaving it untouched.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
setRateLimitsFromPush wholesale-replaced the shared rate-limit store with the paired remote server's own RateLimitService.getState(), which covers every provider, not just Claude/Codex. Since Gemini, MiniMax, Grok, OpenCode Go, Kimi, and Antigravity are never remote-scoped (they always read this desktop's own local credentials), that clobbered their usage with the remote host's unrelated local readings on every snapshot. Add applyRemoteAccountRateLimits to merge in only the Claude/Codex fields and leave the rest of the store untouched. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UPMdb1h2Ens95YLBgjSFRK
|
Good catch — fixed in d43c0a3. Replaced the wholesale |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Scoped remote rate-limit merge —
AccountsPanenow appliessnapshot.rateLimitsthrough a newapplyRemoteAccountRateLimitsaction instead ofsetRateLimitsFromPush, so only the remote-ownedclaude/codex/targets/inactive-account fields are merged and desktop-local providers plus their durability flags survive. - Strengthened test — the remote-snapshot test now seeds a desktop-local
grokusage and asserts (by identity) it is not overwritten by the remote host'sgrokreading, which would fail under the prior wholesale replace.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Opened #21466 with a reproduction of this exact symptom on a paired remote host (Orca 1.4.205 desktop, 1.4.203 remote), including per-account ground truth read from the usage endpoint, the remote host logs, and screenshots of the same popover showing identical figures under two different account names while both headers read "Updated just now". It should cover the linked issue and visual proof the automated review asked for here. Happy to test a build on that setup. |
…e-account-switch-refresh # Conflicts: # src/renderer/src/components/settings/AccountsPane.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Reload local rate limits when leaving the remote scope. · rate-limits.ts:144-155
src/renderer/src/store/slices/rate-limits.ts:144-155
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReload local rate limits when leaving the remote scope.
applyRemoteAccountRateLimitsreplaces the shared Claude/Codex usage, runtime targets, and inactive-account caches. The local account snapshot setsrateLimitstonull, andAccountsPaneskips the update for that snapshot. Local status-bar consumers can therefore continue to use remote targets and caches, while feature-wall consumers can show remote usage.Reload the local rate-limit state when the local snapshot arrives. Keep the existing merge for unrelated providers.
Suggested fix
const applyRemoteAccountRateLimits = useAppStore((s) => s.applyRemoteAccountRateLimits) + const fetchRateLimits = useAppStore((s) => s.fetchRateLimits) ... if (snapshot.rateLimits) { applyRemoteAccountRateLimits(snapshot.rateLimits) + } else if (!activeRuntimeEnvironmentId) { + void fetchRateLimits() } ... - }, [activeRuntimeEnvironmentId, applyRemoteAccountRateLimits]) + }, [activeRuntimeEnvironmentId, applyRemoteAccountRateLimits, fetchRateLimits])
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 3034007a-1d39-4031-a800-2e7fbc60be0b
📒 Files selected for processing (1)
src/renderer/src/components/settings/AccountsPane.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Summary
accounts.subscribestream broadcasts a fresh snapshot after the active Claude/Codex account is switched, the snapshot'srateLimitsfield (refreshed usage for the new account) was received inAccountsPanebut never applied to the shared store.rateLimits:updateIPC push (ClaudeAccountSelection.select()→refreshForClaudeAccountChange()).snapshot.rateLimitsto the store via the existingsetRateLimitsFromPushaction whenever the field is present (it isnullfor local snapshots, so local behavior is unaffected).Test plan
AccountsPane.remote-rate-limit-snapshot.test.tsxcovering: (1) a remote snapshot with a populatedrateLimitspayload updates the store, (2) a local snapshot withrateLimits: nullleaves the store untouched.pnpm run tc:webpnpm vitest run --config config/vitest.config.ts src/renderer/src/components/settings/AccountsPane.test.tsx src/renderer/src/components/settings/AccountsPane.remote-rate-limit-snapshot.test.tsxoxlinton changed files🤖 Generated with Claude Code
https://claude.ai/code/session_01UPMdb1h2Ens95YLBgjSFRK