Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Antigravity limits no longer show old readings after a failed probe #34389

Openmths-mcfs(GitHub profile, opens in a new tab)wants to merge 16 commits intomain fromrefs/pull/34389/headopened View on GitHub

mths-mcfs(GitHub profile, opens in a new tab)commented

Problem

After Antigravity limits load once, a later failed read keeps the old figures on Usage > Limits with no notice, so they look current. #34381 shows it: when the probe's refresh is rejected, the panel "keeps the earlier figures, which never update". The maintainer's note there: "A failed probe should not keep silently showing old readings as current."

#39544 fixes which credential the probe reads. Its CodeRabbit review flags the part it leaves: when the probe cannot read the current account it returns probeFailed, and resolveUsageLimitsAfterProbe keeps showing the previous successful limits. This PR covers that part and touches none of #39544's files.

Change

Antigravity now publishes a failed read as failed: no windows, plus the probe's message. Web and mobile already show that message through the existing limit notices. The next good read brings the windows back.

 AntigravityProvider.refreshUsage
   draft.usageLimits =
+    probed is probeFailed ? probed :                                # failed read shows as failed
     resolveUsageLimitsAfterProbe(published, probed)                 # newer good read still wins, as on main
 managedProvider.applySnapshotBase
+  if retainUsageLimitsOnProbeFailure === false and probed is probeFailed
+    publish probed
   else resolveUsageLimitsAfterProbe(...)                           # unchanged for every other provider

The old reading is held back in two places, the provider's draft and the managed provider's republish, so both change. retainUsageLimitsOnProbeFailure defaults to true, so other providers keep the retention added in #9507.

Not in this PR: after sign-out or an account switch, enrichment can still republish the previous account's limits. That already happens on main. Fixing it means changing how the managed provider publishes enrichment. I tried, and each attempt opened a new ordering problem (a stale flash, a frozen reading after a cancelled refresh, a blocked OpenCode refresh). All of those were reverted here. #39672 takes that on in the managed provider.

Scope

Bug fix for the second half of #34381 (reopened by the maintainer). Complements #39544. The earlier version of this branch, which reported limits as unsupported on the agy CLI, is gone. #39544 replaces it.

Verification

  • apps/server/src/provider/AntigravityProvider.test.ts, case "publishes each limits read, showing a failed read as failed until one recovers": a good read (75%), a failed read, a recovery, an older good read that must not replace a newer one, then unsupported. Each read is gated by a Deferred. Each step checks the refresh result, what streamChanges published (it subscribes before the read completes and collects up to a barrier), and getSnapshot. None of this depends on scheduler order.
    • Suppressing only the stream publish of the failed read makes it fail.
    • With main's production code it fails: the failed read shows as the 75% reading from 12:00:00.
    • Reverting either half of the change (the draft or the managed-provider option) also fails it.
    • On this branch it passes. It ran 10 times in a row, and under a scheduler-yield preload with budgets 1, 12, 25, 40, 80, 100 and 2048.
  • packages/provider-core tests (285) and apps/server src/provider + src/usage (1273) pass.
  • vp run check:changed passes, with typecheck rerun uncached across 27 packages.
  • Not checked: the notice in a real client signed in to Google. It was confirmed by reading collectLimitNotices, not in a running app.

Known limitation, not changed here: if the provider status cache write is slow, ProviderRegistry's queue can apply an older snapshot after a newer one. A failed read can then briefly show the previous bars before the failure returns (probeFailed → 75% → probeFailed). The queue already reorders on main, where the bars just stayed at 75%. Fixing it belongs in the registry's ordering.

Known trade-off: the 5-minute background refresh does not retry. A single 5xx or timeout now replaces the bars with "Could not read limits." until the next good read.

Done with Claude Code (Claude Opus 5.5). Reviewed by Codex GPT-6.2 Sol and Claude Sonnet 5.5.

🤖 Generated with Claude Code

    1. Pushedec71e5c

    2. @juliusmarminge could you take another look at the takeover:blocked label? It was set on Nov 13, and the PR was rewritten on Nov 20–21, so it may no longer apply.

      What changed since the label:

      • The unsupported guard for the agy CLI is gone. #39544 covers the credential order, and this PR shares no files with it.
      • The PR now only covers the failed-probe case from #34381: Antigravity publishes a failed read as failed instead of keeping the previous limits as if they were current. It is 3 files, +126/−64, at ec71e5c.
      • main is merged in and needs-rebase was removed on Nov 21.

      Two things you may want to weigh:

      • This PR and #39672 both edit packages/provider-core/src/server/managedProvider.ts. Whichever lands second will need a merge.
      • Proof and CodeRabbit were skipped on the current head, so the test results in the description are from local runs only.

      If the block still stands, the reason isn't in the PR body. Could you say what is missing, or whether you'd rather fold this into #39544?

    3. This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

      See the conflict window.

Sign in to join this conversation.