Repository navigation
Conversation
…imits Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… isolate browser test
The browser test mocked the presentations atom and the logic test passed on main; accountUsageLimits in usageLimits.test.ts covers both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action not completed
|
Problem
With two linked environments signed in to the same account, the thread details usage bars can disagree depending on which machine the thread runs on. I'm signed in to the same Google account for Antigravity on my Mac and on a Linux laptop, and both run
0.1.12-nightly.20261121.5051. At the same moment, a Mac thread showed Gemini 5-hour 69% / Weekly 90% remaining, and a Linux thread showed 92% / 97%. About 45 minutes later, the Linux thread still showed 92% / 97% while an Antigravity turn on the Linux laptop failed with "Individual quota reached … Resets in 2h58m39s". Nothing in the UI shows that one of the readings is stale./usage-limitsalready merges same-account readings across environments (collectProviderUsageLimitswithaccountKeyResolver).ThreadDetailsUsageonly reads the provider snapshot from the thread's own environment, so a stale or failed reading on that machine is shown even when a linked environment has a fresher reading of the same account.Change
packages/shared/src/usageLimits.ts: pulls the "readable beats unreadable, then newercheckedAtwins" rule out ofcollectProviderUsageLimitsintofresherLimits, and addsaccountUsageLimits(provider, own, peers). It returns the freshest readable limits that any enabled, same-driver, same-account (accountKeyResolver) provider reports across environments. It returns the provider's own reading when the provider is disabled, routed through a custom endpoint (auth.endpoint), or reportsunsupported. Endpoint-routed peers are never borrowed.ThreadDetailsUsage.logic.ts:resolveThreadDetailsLimitstakes the peer providers and usesaccountUsageLimitsfor the instance's own limits. Hub pooling is unchanged.ThreadDetailsUsage.tsx: reads the providers of the other environments fromenvironmentPresentations.presentationsWithProvidersAtom, the same source/usage-limitsuses.No contract, server or provider changes.
Scope
A bug fix. Linked environments on one account show conflicting usage for the same account in thread details, while
/usage-limitsmerges them correctly. The fix is small and provider-agnostic: it keys oncredentialFingerprint/email/ workspace through the existingaccountKeyResolver. It does not touch the Antigravity server-side refresh issues already covered by #39544, #40474, #39740 and #34389. It is separate from #39752 and #39793: endpoint- and hub-routed instances keep their current behaviour here.Known limits, which are intended:
usageLimitsmissing, or aprobeFailedreading with nocredentialFingerprintand noauth.email, as Antigravity reports before fix(server): Antigravity shows the signed-in Google account email #38097), there is nothing to match peers on, so thread details keep showing the local reading./usage-limitsbanner stays local-only.Verification
Tests. The new
accountUsageLimitscases inusageLimits.test.tsfail onmain(accountUsageLimits is not a function) and pass on this branch (usageLimits.test.ts+ThreadDetailsUsage.logic.test.ts: 113 passed;check:changedgreen). They are the only layer tested: the component andresolveThreadDetailsLimitsonly pass the linked environments' providers through. The cases cover same-fingerprint peers for codex, claudeAgent and antigravity; email and workspace keys; a readable peer replacing aprobeFailedown reading; and disabled, different-account, endpoint-routed andunsupportedproviders, which never borrow.Real app, before (official nightly on both machines, same account, readings disagree):
About 45 minutes later, an Antigravity turn on the Linux laptop failed with this error while its thread details still showed 92% / 97%:
Later the same night the two readings disagreed again, this time the other way round. Both screenshots are from the desktop app on the Mac, 18 seconds apart (23:57:15 and 23:57:33). A thread on the Linux laptop showed Gemini 5-hour 0% / Weekly 71%, and a thread on the Mac showed 100% / 100% for the same Google account. As before, nothing in thread details shows which reading is current.
Implementation by Claude Sonnet 5.5 and Gemini 4 Neon in T3 Code; reviewed by Claude Fable 5.2 and Gemini 4 Neon.
🤖 Generated with Claude Code