Skip to content

fix(antigravity): retain cadence-less quota history - #3856

Closed
steipete wants to merge 1 commit into
mainfrom
triage/20260921-antigravity-history
Closed

steipete wants to merge 1 commit into
mainfrom
triage/20260921-antigravity-history

Conversation

@steipete

Copy link
Copy Markdown
Owner

Antigravity fallback pool responses can report usable balances without a reset duration. They currently disappear from quota history, while pace forecasts assume a five-hour window. This adopts the quota-history portion of #3619: account-scoped hourly observations retain the latest capture, including replenishment and delayed responses; persistence and history adoption preserve them. Unknown-cadence summaries use observations, and unavailable snapshots select the freshest stored format.

Recognized structured summaries keep their existing peak history and chart selection, including mixed responses. Local pricing remains on the shared catalog implementation landed in #3757. Duplicate history decoding, ordering, and empty-chart construction are consolidated; the on-disk schema remains version 1.

Thanks @hhh2210! Contributor credit is retained in the commit and changelog.

Validation

With source Scripts/test_environment.sh (isolated session files; Keychain access suppressed):

swift test --jobs 2 --filter 'AntigravityQuotaHistoryTests'

Before the fix: 2 tests in 1 suite failed with 3 issues: the invented pace forecast and missing observations with/without reset metadata.

swift test --jobs 2 --filter 'Antigravity.*History|AntigravityQuota|PlanUtilizationHistoryChartMenuViewTests|UsageStorePlanUtilization|SessionEquivalentForecast|ProviderPresentationPolicyCharacterizationTests|MenuCardAntigravityTests|UsagePaceTests|ProviderArchitectureGatekeeperTests'

After the fix: 420 tests in 22 suites passed. Both regressions passed; structured summary peaks passed with and without reset metadata. The version-1 upgrade, account adoption, persistence, chart selection, and architecture gatekeeper passed.

make check passed: 0 violations in 2,551 Swift files, plus formatting, generated-file, locale, and repository checks. git diff --check and Scripts/check_repository_size.sh passed. Isolated Codex review is clean through P2.

AntigravityHistoryNativeProofTests passed with its render environment variable enabled on both versions (1 test each). See the committed render instructions. The full sharded suite and live account probes were not run, per the lane contract.

Production budget: git diff --shortstat origin/main -- Sources WidgetExtension → 5 files changed, 135 insertions(+), 153 deletions(-) (net −18). Tests: 6 files changed, 474 insertions(+), 16 deletions(-) (net +458).

Synthetic chart proof

Both captures use the production SwiftUI chart and the same five synthetic observations, recorded through UsageStore. They are offscreen renders; no app launch, account, credential, provider request, or menu interaction was used.

Before After
Before: quota history is empty After: captured pool balances are retained

Refs #3619
Refs #3757

Preserve the latest account-scoped pool observation per hour, including replenishment and delayed captures, without inventing reset windows or five-hour pace forecasts. Keep recognized structured summaries on their existing peak-history path.

Retain version-1 persistence and account adoption while consolidating duplicate history decoding, ordering, and empty-chart construction. Add regression coverage and synthetic before/after chart proof.

Refs #3619

Co-authored-by: hhh2210 <hzy2210@gmail.com>
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da627ae534

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +54 to +56
$0.id.hasPrefix("antigravity-quota-summary-") && $0.usageKnown
&& !$0.window.isSyntheticPlaceholder && $0.window.usedPercent.isFinite
&& [self.sessionWindowMinutes, self.weeklyWindowMinutes].contains($0.window.windowMinutes ?? 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve history for partial structured summaries

When a valid response contains only one recognized 5-hour or weekly quota-summary bucket, this predicate suppresses all cadence-less observation samples. However, the structured path in recordPlanUtilizationHistorySample calls sessionEquivalentWindows, which returns no samples unless it finds a complete Gemini session/weekly pair, and the already-computed detectorSamples are not used as a fallback. Such partial summaries therefore record nothing and can make existing observation history disappear from the chart; only select structured mode when the structured recorder can actually emit samples, or retain observations for the unmatched lanes.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed September 22, 2026, 1:55 AM ET / 05:55 UTC.

ClawSweeper review

What this changes

Retains account-scoped Antigravity quota observations without a known reset cadence, preserves them through persistence and adoption, and removes unsupported five-hour pace forecasts.

Merge readiness

⛔ Needs changes before merge - 2 items remain

The quota-history fix remains useful, but the reported partial-summary defect is still present: a valid refresh can hide the newly retained observations without recording replacement history.

Priority: P2
Reviewed head: da627ae534b633bb3eb1e70611e08b61b81f1698

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused coverage, upgrade checks, and transparent chart evidence support the approach, but partial-summary selection remains a correctness blocker.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.
Evidence reviewed 9 items Pinned patch and policy: Read the complete root AGENTS.md and inspected the introduced base-to-head diff. No nested AGENTS.md or maintainer-notes directory was found. The review followed provider isolation and focused, non-Keychain validation guidance; no builds or tests were executed in this read-only review.
Quota fix remains necessary: Both pinned main and v0.64.0 record Antigravity history only through the session-equivalent path; neither includes the added observation recorder. Main also permits a five-hour pace forecast when the duration is nil. The merged pricing work at #3757 addresses a separate local-cost surface.
Partial-summary selection mismatch: The new predicate treats any usable five-hour or weekly summary bucket as sufficient to suppress observations and select structured history. However, the existing structured recorder requires a complete Gemini session/weekly pair. A pool capture followed by a Gemini-session-only response consequently hides the stored observation series while recording no replacement.
Findings 1 actionable finding [P2] Preserve observations when a structured summary cannot be recorded
Security None None.

How this fits together

Antigravity quota responses feed CodexBar’s account-scoped usage history. The history recorder stores samples, and the menu chart selects either structured quota windows or cadence-less observations.

flowchart TD
  A[Antigravity quota response] --> B[Parsed usage snapshot]
  B --> C[Choose history format]
  C --> D[Structured quota samples]
  C --> E[Hourly observations]
  D --> F[Account history and disk storage]
  E --> F
  F --> G[Menu history chart]
  B --> G
Loading

Before merge

  • Preserve observations when a structured summary cannot be recorded (P2) - After a pool snapshot has populated observation history, a valid response containing only gemini-session makes this new check return false. The chart then filters out every observation series, while sessionEquivalentWindows requires a complete Gemini session/weekly pair and records nothing. The result is an empty chart, or stale structured history, despite usable balances and retained observations. Align this decision and the observation-recording guard with actual structured recordability, and cover the pool-to-partial-summary transition.
  • Complete next step (P2) - Repair the partial-summary selection mismatch and add a regression covering retained observations across that refresh.

Findings

  • [P2] Preserve observations when a structured summary cannot be recorded — Sources/CodexBar/Providers/Antigravity/AntigravityQuotaHistory.swift:18
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta Production +135/−153; tests +474/−16 The observation feature is offset by consolidation, while tests add focused recording, upgrade, and rendering coverage.

Technical review

Best possible solution:

Use a consistent recordability decision for history capture and chart selection so incomplete summaries preserve usable observations while complete Gemini pairs retain structured peak semantics.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: record a cadence-less pool snapshot, then supply a valid Gemini-session-only summary; observation selection becomes false while structured recording yields no samples. This review did not execute tests.

Is this the best way to solve the issue?

Mostly: separate observation series and explicit-duration pace rules fit the existing architecture, but format selection must agree with what the structured recorder can emit.

Full review comments:

  • [P2] Preserve observations when a structured summary cannot be recorded — Sources/CodexBar/Providers/Antigravity/AntigravityQuotaHistory.swift:18
    After a pool snapshot has populated observation history, a valid response containing only gemini-session makes this new check return false. The chart then filters out every observation series, while sessionEquivalentWindows requires a complete Gemini session/weekly pair and records nothing. The result is an empty chart, or stale structured history, despite usable balances and retained observations. Align this decision and the observation-recording guard with actual structured recordability, and cover the pool-to-partial-summary transition.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b99a91694d78.

Labels

Label changes:

  • add P2: This repairs provider-specific history and forecast behavior with a limited blast radius.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.

Label justifications:

  • P2: This repairs provider-specific history and forecast behavior with a limited blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The OWNER-authored PR is exempt from external runtime proof. Inspected synthetic renders exercise UsageStore and the production chart, showing empty-to-populated history; they do not demonstrate live menu operation. Literal version-1 fixtures, unchanged decoding, and reported passing persistence/restart coverage support existing-state compatibility.

Evidence

Acceptance criteria:

  • [P1] source Scripts/test_environment.sh && swift test --jobs 2 --filter 'AntigravityQuotaHistoryTests|AntigravityHistoryUpgradeTests|PlanUtilizationHistoryChartMenuViewTests|UsageStorePlanUtilization|SessionEquivalentForecast'.
  • [P1] make check.
  • [P1] make test.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Fix partial-summary capture and chart selection together, with a regression covering a populated observation chart followed by an incomplete structured response.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

steipete added a commit that referenced this pull request Sep 22, 2026
Preserve the latest account-scoped pool observation per hour, including replenishment and delayed captures, without inventing reset windows or five-hour pace forecasts. Keep recognized structured summaries on their existing peak-history path.

Retain version-1 persistence and account adoption while consolidating duplicate history decoding, ordering, and empty-chart construction. Add regression coverage and synthetic before/after chart proof.

Refs #3619

Co-authored-by: hhh2210 <hzy2210@gmail.com>
(cherry picked from commit da627ae)
steipete added a commit that referenced this pull request Sep 22, 2026
Preserve the latest account-scoped pool observation per hour, including replenishment and delayed captures, without inventing reset windows or five-hour pace forecasts. Keep recognized structured summaries on their existing peak-history path.

Retain version-1 persistence and account adoption while consolidating duplicate history decoding, ordering, and empty-chart construction. Add regression coverage and synthetic before/after chart proof.

Refs #3619

Co-authored-by: hhh2210 <hzy2210@gmail.com>
(cherry picked from commit da627ae)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant