Skip to content

fix(ai): antigravity quota buckets keyed only by derived label — an unrecognized bucket overwrites the real 5h window, same-label buckets silently drop, missing remainingFraction counts as fully remaining #1768

Closed

Description

@dezren39

Summary

The antigravity quota provider (packages/ai/src/quota/providers/antigravity.ts, 461 lines — the largest quota provider) keys every bucket window by a label derived from substring matching, defaults any unrecognized window string to "5h", and lets later buckets silently overwrite earlier ones with the same label. Its transforms (parseBucket, transformSummary, transformModels) are module-private, and packages/ai/test/quota.test.ts has zero antigravity coverage while sibling parsers were pinned in #1725 / #1750 (PR #1766).

Evidence (verified this run, main 4b9febf)

Probe on the laptop (~/git/fleet/probe-2026-11-05-antigravity-quota/, byte-identical copy of the source with only an export line appended — diff-verified identical) driving transformSummary / parseBucket:

  1. An unrecognized bucket overwrites the genuine 5h window with wrong data. Group buckets [{window:"FIVE_HOUR", remainingFraction:0.5}, {window:"MONTHLY", remainingFraction:0.9}] produce a single "5h" window with usedPercent: 10, windowSeconds: 18000, and the monthly bucket's reset time (Dec 1). parseBucket (antigravity.ts:283-296) defaults label = "5h" / FIVE_HOUR_WINDOW_SECONDS when the window string matches neither week nor day keywords, and transformSummary (antigravity.ts:326) does windows[parsed.label] = parsed.window — last wins, no trace of the dropped bucket.
  2. Same-label collisions drop windows. Buckets [{window:"WEEKLY", remainingFraction:0.25}, {window:"7D", remainingFraction:0.75}] both derive label "weekly"; the published window is the second one (25% used) and the first is silently gone. bucket5h / bucketWeekly are overwritten the same way (antigravity.ts:327-328). This is the defect class fixed for opendesign in test(ai): quota suite pins none of claude / meta-billing / opendesign's pure parsers — billing banner rejects numeric strings, claude transform drops legacy windows when limits is non-empty, coding-plan publishes a zero-limit window #1750 ("duplicate durations keep the first entry instead of silently overwriting") and filed for codex in fix(ai): codex quota windows keyed only by derived duration label — a missing or shared limit_window_seconds silently drops one window, and an empty window object mints a phantom all-null window #1762 — antigravity has neither the fix nor the pins.
  3. A missing remainingFraction is treated as fully remaining for ordering. parseBucket returns remainingFraction: remainingFraction ?? 1 (antigravity.ts:295) while usedPercent is honestly null. That invented 1 feeds transformModels' weekly-constrained comparison (antigravity.ts:355-358), so window ordering is decided by data the wire never sent.

Why it matters

Quota output drives pool-rotation decisions in this fork. A monthly (or any future/unrecognized) bucket silently relabelled as the 5h window publishes a confident, wrong used-percent with a mismatched reset time — worse than an honest absence (the groq provider's no-quota-surface precedent). Because the transforms are unexported, no test can pin any of this today.

Acceptance criteria

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/aiPackage: ai (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 5, 2026
  2. dezren39 commented on Nov 5, 2026

    @dezren39
    Author

    🤖 Agent note · filed

  3. added
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 5, 2026
  4. 8 remaining items

  5. added
    work/assignedAn agent holds this item via the queue (claimed task)
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 5, 2026
  6. dezren39 commented on Nov 5, 2026

    @dezren39
    Author

    🤖 Agent note · handed off — task 10763 (queue repo-health-opencode-pilot, lane opencode-a)

  7. dezren39 commented on Nov 5, 2026

    @dezren39
    Author

    🤖 Agent note · handed off — task 10763 (queue repo-health-opencode-pilot, lane opencode-a)

    • Agent: queue worker (repo-worker-opencode)
    • Execution lane: opencode — checkpointed handed_off; the laptop claimant (opencode-claimant) launches the bound opencode session that drives this task to its terminal state.
  8. dezren39 commented on Nov 6, 2026

    @dezren39
    Author

    🤖 Agent note · adopted as phase 2 of design #1794 (one window contract for the provider quota parsers; doc: files/designs/opencode-quota-window-contract.md, keep-the-four-repos-healthy goal workspace). This issue is the contract's antigravity application: rule 6 (unknown kinds skipped, not renamed "5h"), rule 2 (duplicates keep the first), rule 3 (a missing remainingFraction is null, never 1). Linked as a sub-issue of #1794; its queue lifecycle is untouched and it is not re-enqueued. When it lands, design phase 1's inventory row for antigravity flips from known-lossy to conforming and its matrix cases join the asserted set.

  9. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    and removed
    queue/claimedA queue worker has claimed the task for this item
    on Nov 6, 2026
  10. dezren39 commented on Nov 6, 2026

    @dezren39
    Author

    🤖 Agent note · parked — task 10763 (queue repo-health-opencode-pilot, lane opencode-a)

  11. added a commit that references this issue on Nov 6, 2026
  12. removed
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedAn agent holds this item via the queue (claimed task)
    on Nov 6, 2026
  13. dezren39 commented on Nov 6, 2026

    @dezren39
    Author

    agent-note:v1 — state: completed via PR #1837 merged 2026-11-06; task 10763 complete. No Codex findings on #1837; mergeable clean; no gh CI checks reported for this repo — merge rested on diff vs acceptance + PR-recorded quota.test.ts 83 pass / typecheck clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aiPackage: ai (pkgs/ or apps/ in this repo)area/typescriptTypeScript code areaeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)kind/testTest coverage, test infrastructure, or test-only fixespriority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions