Skip to content

fix(antigravity): preserve quota history and estimate local token costs - #3619

Closed
hhh2210 wants to merge 9 commits into
steipete:mainfrom
hhh2210:fix/antigravity-history-and-cost
Closed

hhh2210 wants to merge 9 commits into
steipete:mainfrom
hhh2210:fix/antigravity-history-and-cost

Conversation

@hhh2210

@hhh2210 hhh2210 commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Antigravity can return usable pool balances without a reset duration. This preserves those account-scoped observations, avoids assuming a five-hour pace, and adds explicitly labeled API-equivalent estimates to the existing local token-history reader.

Observation history keeps the latest value and actual capture time per hour, including replenishment without reset metadata and account-history adoption. Structured windows retain their existing peak semantics. Valid summary balances with an unknown/omitted cadence use observations; unavailable responses choose the freshest stored format, with structured windows winning timestamp ties. Existing history and account boundaries remain intact.

Supported Claude and Gemini events receive dated API-rate estimates. Dotted Claude version spellings normalize for pricing while the recorded model ID stays unchanged. Separately recorded reasoning is priced as output where the source establishes disjoint buckets. Unknown models and cache writes without an established duration remain unpriced, retain their tokens, and expose unpriced request counts even when no dollar total exists. Retired picker aliases are not repriced as successor generations. These estimates are not Antigravity subscription charges or credit deductions.

Evidence and remaining proof gap

The September 18 review of 6b191abab confirmed that all three prior findings are resolved and found no new actionable code defect. It accepted the images below as populated production-chart renders, but real native app setup proof remains outstanding. These synthetic offscreen captures do not establish the integrated menu workflow in a real app setup. That proof still requires a suitable test environment or maintainer acceptance of the current evidence.

Production chart rendering

The opt-in AntigravityHistoryNativeProofTests renders the actual PlanUtilizationHistoryChartMenuView and CostHistoryChartMenuView from synthetic fixtures. The quota fixture records through UsageStore; the Cost fixture reads two unknown-model SQLite records through AntigravityLocalReader. It does not replace the charts or disclosures with mock text.

Populated quota observations

All-unpriced Cost chart

Render receipt · Reproduction command

The observation image shows populated bars and the latest 20% balance after 82%. The separate Cost image shows token usage and the explicit 2 unpriced requests disclosure without a fabricated dollar total. The receipt records the selected observation series, values, and disclaimer from production models.

These are native SwiftUI NSHostingView bitmap captures, not a full menu-interaction end-to-end test. No app launch, visible windows, real accounts, credentials, provider requests, or production history files were used. The earlier empty-track screenshots are superseded by these populated renders.

Review fixes and validation

  • Same-hour 80% → 20% with absent/unchanged reset metadata, then a delayed older 90% capture: latest value/time and chart format freshness are retained. Account/unscoped history adoption follows the same rule; structured peak tests remain in the focused run.
  • Real quota-summary buckets with unknown and omitted cadences pass through toUsageSnapshot → UsageStore → chart selection, preserving 75%/50% observations despite stale weekly history.
  • SQLite fixtures for claude-opus-4-6-thinking, claude-opus-4.6-thinking, and claude-opus-4.6 assert numeric estimates, raw model identity, reasoning accounting, and estimated/unpriced counts.
  • The hosted Cost chart fingerprint includes its actual coverage disclosure, so a changed unpriced count refreshes the view even when token totals and dollar cost stay identical.
  • Existing populated version-1 upgrade coverage checks two accounts, unscoped history, identity metadata, both response formats, persistence, and restart. Existing partial/all-unpriced reader/fetcher/CLI cases remain.

At 6b191abab (September 18):

  • make check passed: SwiftFormat, strict SwiftLint (2,355 files, zero violations), generated-file, locale, JavaScript/TypeScript, package, shell, and test-runner checks.
  • Focused swift test --jobs 2 --filter 'Antigravity|CostHistoryChartMenuView|MenuCardAntigravity|ProviderArchitectureGatekeeper|ProviderPresentationPolicyCharacterization|PlanUtilizationHistory|UsageStorePlanUtilization' passed: 757 tests in 50 suites plus 18 tests in three cross-platform suites, including the native render fixture and disclosure-cache regression.
  • git diff --check and repository artifact-size checks passed.
  • Full make test completed: 1,191 selections in 110 groups. One group needed a retry: TTYCommandRunnerEnvTests.fast process exit drains buffered PTY output; the full-group retry recovered, with no timed-out groups. This is the September 18 result, not a test run of the new integration head.
  • All nine remote checks passed at 6b191abab, including both macOS test shards (CI run). ClawSweeper found no actionable code findings on that head; the real-app proof gap above remains.

September 19 main integration

12ab05d91 is an ordinary merge of main@1d8cb13d3 (0.61.0 release notes). The only hand-resolved conflict was CHANGELOG.md: this PR's two entries now remain under Unreleased, while the published 0.61.0 notes are retained. The previous history, pricing, and disclosure-cache fixes are unchanged.

make check passed at this head (including strict SwiftLint across 2,420 files, zero violations), the PR diff against current main passes git diff --check, and a static source check confirms all 397 pinned architecture-gatekeeper anchors still match. The new remote CI run is pending.

No new local Swift tests, AppKit/status-bar tests, chart rendering, or app launch were performed for this merge. The tests and images above remain labeled with their original source head. No rebase or force-push.

Prior SQLite-to-CLI evidence remains available: all-unpriced text, all-unpriced JSON. These September 16 transcripts were captured at eaabc0d1e, before the current repair; they are historical CLI evidence, not current-head validation.

Pricing references: Gemini API pricing, Claude API pricing.

Copilot AI lite review requested due to automatic review settings September 13, 2026 15:20
@clawsweeper

clawsweeper Bot commented Sep 13, 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 commented Sep 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T05:10:18.797571Z eaabc0d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 18, 2026, 1:19 PM ET / 17:19 UTC (Revision 7).

ClawSweeper review

What this changes

Preserves Antigravity quota history without an advertised reset duration and adds local API-equivalent cost estimates with explicit unpriced-usage disclosures.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: the contribution remains useful, prior code findings are resolved, and no new actionable defect was found. Real native-app proof remains the merge blocker.

Priority: P2
Reviewed head: 12ab05d9113defa0759a9bbb527860e6dc02d677

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch and regression coverage are solid, but the acknowledged native-app proof gap limits merge readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Needs real behavior proof before merge: inspected images demonstrate populated production charts from synthetic UsageStore and SQLite fixtures at 6b191ab, while historical CLI transcripts demonstrate unpriced output. They do not establish the changed native menu behavior in a real app setup, a gap explicitly acknowledged in the captured body. Add screenshots or a recording from the updated app showing populated observations and the all-unpriced disclosure; redacted logs or diagnostic output also count where they demonstrate the behavior. Redact private information, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Needs real behavior proof before merge: inspected images demonstrate populated production charts from synthetic UsageStore and SQLite fixtures at 6b191ab, while historical CLI transcripts demonstrate unpriced output. They do not establish the changed native menu behavior in a real app setup, a gap explicitly acknowledged in the captured body. Add screenshots or a recording from the updated app showing populated observations and the all-unpriced disclosure; redacted logs or diagnostic output also count where they demonstrate the behavior. Redact private information, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed 10 items Repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes files were found. Applied provider isolation, safe test inspection, and native UI validation guidance without running builds or tests.
Current main still lacks the requested estimates: The current-main local reader emits nil dollar costs, and its fetcher assigns unknown provenance. Main also permits a session pace when Antigravity omits the duration. The requested behavior therefore remains distinct from current main.
Prior findings remain resolved: Observation compaction retains the latest capture, supported-cadence checks permit unknown-cadence observations, and Claude pricing normalizes dotted versions. Git tree entries confirm the quota helper, pricing helper, and cost chart are byte-identical to the previously reviewed 6b191ab head. A broader historical diff could not complete because a historical object was unavailable; no broader unchanged-code claim is made.
Findings None None.
Security None None.

How this fits together

CodexBar records Antigravity quota snapshots for menu charts and reads local token-history files for cost displays. This change affects history persistence, chart presentation, and CLI cost output.

flowchart LR
  A[Quota snapshots] --> B[Cadence classification]
  B --> C[Account history]
  C --> D[Menu charts]
  E[Local token records] --> F[Dated price estimates]
  F --> G[Costs and unpriced coverage]
  G --> D
  G --> H[CLI output]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Needs real behavior proof before merge: inspected images demonstrate populated production charts from synthetic UsageStore and SQLite fixtures at 6b191ab, while historical CLI transcripts demonstrate unpriced output. They do not establish the changed native menu behavior in a real app setup, a gap explicitly acknowledged in the captured body. Add screenshots or a recording from the updated app showing populated observations and the all-unpriced disclosure; redacted logs or diagnostic output also count where they demonstrate the behavior. Redact private information, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review.
  • Complete next step (P2) - Add redacted native-app proof showing populated quota observations and the all-unpriced Cost disclosure from the updated build.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta Production +221/-41 lines; tests +659/-26 lines Production growth supports quota observations and pricing, with focused coverage for persistence, pricing, presentation, and prior findings.

Technical review

Best possible solution:

Retain account-scoped observations and transparent local estimates, with native menu evidence confirming the persisted data and disclosures reach users correctly.

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

Yes, source inspection establishes the durationless-history gap and absent local pricing on main; no live current-main reproduction was executed.

Is this the best way to solve the issue?

Yes, the patch extends existing history and reader paths, preserves account storage, and reuses Claude pricing while explicitly retaining unpriced usage. The open alternative pricing PR is not an already-supported replacement.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Antigravity history and cost improvement without evidence of an urgent core-runtime failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Needs real behavior proof before merge: inspected images demonstrate populated production charts from synthetic UsageStore and SQLite fixtures at 6b191ab, while historical CLI transcripts demonstrate unpriced output. They do not establish the changed native menu behavior in a real app setup, a gap explicitly acknowledged in the captured body. Add screenshots or a recording from the updated app showing populated observations and the all-unpriced disclosure; redacted logs or diagnostic output also count where they demonstrate the behavior. Redact private information, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Needs real behavior proof before merge: inspected images demonstrate populated production charts from synthetic UsageStore and SQLite fixtures at 6b191ab, while historical CLI transcripts demonstrate unpriced output. They do not establish the changed native menu behavior in a real app setup, a gap explicitly acknowledged in the captured body. Add screenshots or a recording from the updated app showing populated observations and the all-unpriced disclosure; redacted logs or diagnostic output also count where they demonstrate the behavior. Redact private information, then update the PR body for automatic re-review; if needed, ask a maintainer to comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes files were found. Applied provider isolation, safe test inspection, and native UI validation guidance without running builds or tests. (AGENTS.md:1, 12ab05d9113d)
  • Current main still lacks the requested estimates: The current-main local reader emits nil dollar costs, and its fetcher assigns unknown provenance. Main also permits a session pace when Antigravity omits the duration. The requested behavior therefore remains distinct from current main. (Sources/CodexBarCore/CostUsageFetcher.swift:1266, 1d8cb13d3fba)
  • Prior findings remain resolved: Observation compaction retains the latest capture, supported-cadence checks permit unknown-cadence observations, and Claude pricing normalizes dotted versions. Git tree entries confirm the quota helper, pricing helper, and cost chart are byte-identical to the previously reviewed 6b191ab head. A broader historical diff could not complete because a historical object was unavailable; no broader unchanged-code claim is made. (Sources/CodexBar/AntigravityQuotaHistory.swift:5, 12ab05d9113d)
  • Persistence and upgrade coverage: The added upgrade test starts from a literal populated version-1 document, retains two accounts, unscoped history and identity metadata, records both response formats, and checks persistence and restart. Fresh-history tests also cover observation recording and disk round trips. These tests were inspected, not executed during this read-only review. (Tests/CodexBarTests/AntigravityHistoryUpgradeTests.swift:9, 12ab05d9113d)
  • Inspected native rendering evidence: Both prepared images were opened locally. They visibly show populated quota bars ending at 20% and 396 tokens with two unpriced requests. Their README and capture implementation identify synthetic NSHostingView renders without an app launch or menu interaction. The captured PR body explicitly acknowledges that remaining gap; sourceRevision fd34101e78e2d12f3c9bc71b0850fe349617ff6196517f26708b1751ee3d8d36 was retained as the discussion snapshot. (.github/pr-proof/antigravity-history/README.md:3, 6b191abab05b)
  • Historical CLI evidence: The linked text and JSON transcripts show 396 tokens, two unpriced requests, unknown provenance, and no fabricated dollar total. The PR identifies these as September 16 evidence from eaabc0d; they support CLI behavior but do not demonstrate the repaired native menu workflow. (evidence/cli-unpriced-text.txt:1)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Yuxin Qiao: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Provide native-app evidence showing populated quota observations and the all-unpriced Cost disclosure from the updated build.

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.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-13T15:23:46.672Z sha 53d35b5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-14T04:36:40.611Z sha 26b48da :: needs real behavior proof before merge. :: [P2] Use persisted history when a snapshot contains no quota data
  • reviewed 2026-09-14T05:03:35.467Z sha 7e20e47 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T05:03:37.985Z sha eaabc0d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T05:30:09.027Z sha eaabc0d :: needs real behavior proof before merge. :: [P2] Preserve the latest cadence-less observation | [P2] Retain usable summary balances when cadence is unknown | [P2] Normalize dotted Claude versions before pricing
  • reviewed 2026-09-18T11:47:27.170Z sha 6b191ab :: needs real behavior proof before merge. :: none

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved moderate review findings require fixes before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds Antigravity quota-history observations and local API-rate token-cost estimates, with updated pace eligibility, UI/CLI disclosures, documentation, and tests.

Changes:

  • Preserves durationless legacy quota observations without synthetic cadence.
  • Adds dated Claude/Gemini estimates and unpriced-request tracking.
  • Updates presentation, documentation, changelog, and test coverage.
File summaries
File Change / final review note
Tests/CodexBarTests/ProviderPresentationPolicyCharacterizationTests.swift Updated pace-policy characterization tests.
Tests/CodexBarTests/ProviderArchitectureGatekeeperTests.swift Updated source-location assertions.
Tests/CodexBarTests/MenuCardAntigravityTests.swift Tests explicit session-duration behavior.
Tests/CodexBarTests/AntigravityQuotaHistoryTests.swift Tests observation persistence and chart behavior.
Tests/CodexBarTests/AntigravityLocalPricingTests.swift Tests pricing and unpriced coverage. Nit (1 vote): improve test-name wording.
Tests/CodexBarTests/AntigravityCLICostTests.swift Tests CLI estimate output.
Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift Updates pace and estimate presentation. Moderate (1 vote): show coverage messaging even when no priced total exists.
Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift Aggregates local costs and coverage metadata.
Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalPricing.swift Adds dated model pricing. Moderate (2 votes): canonicalize retired Flash aliases. Moderate (2 votes): add Claude-thinking pricing coverage tests.
Sources/CodexBarCore/CostUsageFetcher.swift Publishes cost snapshots. Moderate (1 vote): add fixture coverage for estimated-cost and provenance mapping.
Sources/CodexBarCLI/CLIHelp.swift Documents local cost estimates.
Sources/CodexBarCLI/CLICostCommand.swift Displays estimates and coverage. Moderate (3 votes): report unpriced coverage when all requests are unpriced.
Sources/CodexBar/UsageStore+PlanUtilization.swift Persists Antigravity history samples.
Sources/CodexBar/PlanUtilizationHistoryStore.swift Supports cadence-free observation history.
Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift Renders observation timestamps. Moderate (1 vote): define fallback behavior when observations and structured histories coexist without a snapshot.
Sources/CodexBar/AntigravityQuotaHistory.swift Defines legacy pool observations.
docs/antigravity.md Documents quota-history and pricing behavior.
CHANGELOG.md Records the Antigravity changes.
Review details

Suppressed comments (4)

Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:198

  • If snapshot is nil while an account has both legacy observation histories and structured session/weekly histories, this fallback sets usesObservations to true merely because any observation exists and hides every structured series. The chart can therefore show stale pool data or no data during an unavailable/initial-refresh state; without a snapshot, the code needs an explicit policy that does not arbitrarily discard one retained history set.
                let usesObservations = snapshot.map { !UsageStore.hasAntigravityQuotaSummary($0) }
                    ?? histories.contains { $0.name.isQuotaObservation }
                guard history.name.isQuotaObservation == usesObservations else { continue }

Sources/CodexBarCore/CostUsageFetcher.swift:1261

  • The new fetcher-to-snapshot mapping is not exercised by the added tests: pricing tests stop at DailyReportResult, while the CLI tests construct CostUsageTokenSnapshot values manually and the existing fixture uses an unpriced model. A regression in the selected-day cost aggregation or .listPriceEstimate provenance here could therefore pass all tests. Add a fixture-backed snapshot assertion covering estimated cost and coverage propagation.
        return Self.tokenSnapshot(
            from: daily,
            now: now,
            historyDays: historyDays,
            useCurrentLocalDayForSession: true,
            calendar: cal,
            historyCoverageIsEstablished: reportResult.isComplete,
            costProvenance: filtered.contains { $0.costUSD != nil } ? .listPriceEstimate : .unknown)

Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:58

  • This new chart disclaimer is only rendered inside CostHistoryChartMenuView when totalCostUSD is non-nil. If all local requests are unpriced, the daily token rows still appear but the total is nil, so the menu omits both the estimate disclaimer and any explanation for the missing dollar values; make the coverage message render independently of a priced total (including the unpriced count) so the UI does not silently present incomplete history.
                chartEstimateDisclaimer: .literal("API estimate · not billed · unpriced usage excluded")),

Tests/CodexBarTests/AntigravityLocalPricingTests.swift:7

  • The test name has subject-verb agreement and wording issues: use “estimates each disjoint token bucket and honors the published cutoff.”
    func `Gemini estimates price each disjoint token bucket and honor the published cutoff`(seconds: UInt64) throws {
  • Files reviewed: 18/18 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +415 to +416
hasEstimates && unpriced > 0
? "Partial API-rate estimate: \(unpriced) requests have no supported price." : nil,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 25d74f5: unpriced coverage is now shown even when no request has an estimate. The chart disclosure is also independent of the dollar total. Added fixture-backed partial/all-unpriced cases through the local reader, fetcher and CLI, including an out-of-range priced event that must not affect provenance. Formatting and strict lint pass; execution of the new tests is delegated to CI.

Comment on lines +11 to +20
if model.hasPrefix("claude-") {
let apiModel = model.hasSuffix("-thinking") ? String(model.dropLast("-thinking".count)) : model
return CostUsagePricing.claudeCostUSD(
model: apiModel,
inputTokens: event.input,
cacheReadInputTokens: usage.cacheRead,
cacheCreationInputTokens: event.cacheWrite,
outputTokens: output,
pricingDate: date,
modelsDevCatalog: ModelsDevCatalog(providers: [:]))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a claude-opus-4-6-thinking fixture in 25d74f5 asserting the numeric estimate, reasoning-as-output, raw model identity and estimated/unpriced counts. Also added fetcher-to-CLI coverage. The PR body now includes actual synthetic SQLite-to-CLI output from the existing 53d35b5 binary; the newly added tests await CI.

Comment on lines +25 to +26
guard ["gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash"].contains(model),
event.cacheWrite == 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked canonicalModelID and am deliberately keeping these historical IDs unpriced. Its retiredFlashTiers table redirects retired picker generations to their successor (for example, 3.5 to 3.7); this is a routing compatibility rule, not evidence that an old request used the successor model or its historical price. Applying it to recorded usage would silently reprice old generations. In 25d74f5 I documented this boundary and added regression tests for both examples. A verified historical price or same-model alias can be added separately; the request count now remains visible even when all usage is unpriced.

@hhh2210

hhh2210 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Review fixes are in 25d74f5; current head 26b48da also merges upstream main at 6e9e73f and resolves the conflicts that were preventing ordinary CI from starting. The body now includes actual synthetic SQLite-to-CLI text/JSON evidence, populated version-1 upgrade coverage through both refresh formats and persistence/reload, fully unpriced CLI/chart disclosure, and freshest-format fallback when a snapshot is unavailable.

The retired-picker alias suggestion is answered inline: successor routing does not establish historical prices. Formatting and strict lint pass again after the merge; new regression execution and current-head CI remain pending. No fresh app screenshot is claimed; chart validation remains at the persistence/model seam. Please assess the supplied evidence and remaining gap on that basis.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 14, 2026

@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: 26b48da90c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

] {
let chart = PlanUtilizationHistoryChartMenuView._modelSnapshotForTesting(
histories: histories, provider: .antigravity, snapshot: snapshot, referenceDate: now)
#expect(Set(chart.visibleSeries) == Set(names))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make the structured chart expectation reachable

When this loop reaches structured, standardPlanUtilizationSeries returns only .weekly because the snapshot contains a 10,080-minute window; visibleSeries then applies that set as allowedNames, filtering out session:300. The actual set is therefore only ["weekly:10080"], so this new expectation deterministically fails unless Antigravity's structured visibility policy is changed to admit the session series or the expected list is reduced.

AGENTS.md reference: AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Corrected in 7e20e47. The existing standardPlanUtilizationSeries policy intentionally exposes only weekly when a weekly window is available; the test now expects weekly:10080. Session and weekly preservation assertions remain unchanged. The macOS CI log confirms this was the only recorded issue in the upgrade test; the persistence/reload assertions recorded none. I kept the product policy rather than changing it to satisfy an incorrect expectation.

Comment on lines +15 to +18
inputTokens: event.input,
cacheReadInputTokens: usage.cacheRead,
cacheCreationInputTokens: event.cacheWrite,
outputTokens: output,

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 Do not assume a five-minute TTL for Claude cache writes

When an accepted Antigravity JSONL Claude event has a nonzero cacheWrite, the source format supplies no 5-minute-versus-1-hour cache duration, but this call passes every write as cacheCreationInputTokens and leaves cacheCreationInputTokens1h at its zero default. claudeCostUSD consequently prices every such write at the 5-minute rate even though 1-hour writes use a different rate, producing an incorrect API-equivalent estimate; preserve the duration if available or treat duration-less Claude cache writes as unpriced.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7e20e47: cache-write events without a duration remain unpriced for both Claude and Gemini, while all token counts and unpriced coverage are retained. Added four JSONL fixture cases (both model families, with and without writes) and documented the duration boundary. Formatting and strict lint passed; current-head test execution is pending in CI.

@hhh2210

hhh2210 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed 7e20e47. Non-nil offline/empty snapshots now use the persisted-format fallback unless they contain usable quota data; added ten cases covering offline, empty, placeholder, non-finite and unknown-summary responses against newer pool/structured histories. Also addressed the Codex cache-write review: duration-less writes retain tokens and remain unpriced, with four JSONL cases.

The macOS CI log at 26b48da executed the populated upgrade scenario. Its only recorded issue was my incorrect session-plus-weekly chart expectation; that is now corrected to the existing weekly-only policy. Account preservation and save/reload assertions were retained. The PR body links this evidence and distinguishes the failed previous run from pending current-head validation.

Formatting and strict lint pass. CLI tests now emit synthetic partial/all-unpriced output for CI evidence. No native-app screenshot is claimed; no local App build was performed.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 16, 2026

@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: eaabc0d1e7

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

snapshot: snapshot,
capturedAt: now,
forSessionEquivalents: true)
+ Self.antigravityQuotaObservationSamples(snapshot: snapshot, capturedAt: now)

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 the latest cadence-less observation

When a cadence-less pool's usage decreases within the same hour without a meaningfully different resetsAt value (for example, a reset or replenishment when the source omits reset metadata), routing these samples through the generic history updater keeps the earlier hourly peak and its earlier capturedAt. The chart therefore continues to show the stale higher value, and antigravityHistoryUsesObservations can later misidentify the newest response format because it compares those retained timestamps. Quota-observation series should retain the latest capture/freshness independently rather than using peak-only compaction.

Useful? React with 👍 / 👎.

Comment on lines +13 to +14
if model.hasPrefix("claude-") {
let apiModel = model.hasSuffix("-thinking") ? String(model.dropLast("-thinking".count)) : model

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 Normalize Antigravity's dotted Claude model IDs

When a local event uses Antigravity's dotted Claude spelling, such as claude-opus-4.6-thinking (the same model ID form already exercised in AntigravityCLIHTTPSFetchStrategyTests.swift), removing -thinking passes claude-opus-4.6 to claudeCostUSD. Its normalization does not convert the internal dot, while the built-in pricing key is claude-opus-4-6, so these otherwise supported Claude events are silently counted as unpriced. Normalize Antigravity's dotted version component before invoking the Claude pricing resolver.

Useful? React with 👍 / 👎.

Comment on lines +9 to +12
if snapshot.extraRateWindows?.contains(where: {
$0.id.hasPrefix("antigravity-quota-summary-") && $0.usageKnown
&& !$0.window.isSyntheticPlaceholder && $0.window.usedPercent.isFinite
}) == true { return false }

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 Fall back to observations for unknown summary cadences

When a quota-summary bucket has a valid remaining fraction but an unrecognized or omitted cadence, AntigravityStatusSnapshot can emit a usageKnown summary window whose windowMinutes is nil. This check nevertheless forces structured-history mode, while antigravityQuotaObservationSamples rejects every snapshot containing a summary row and the structured recorder cannot form its required 300/10,080-minute pair. Consequently the usable balance is not recorded and the chart hides newer observation history in favor of stale structured rows. Only select structured mode when the known summary exposes a supported cadence; otherwise preserve it as a cadence-less observation.

Useful? React with 👍 / 👎.

@hhh2210

hhh2210 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Summary of updates since the last review:

  • Merge resolved: ef4a86567 merges main at 68a9005a2. Only CHANGELOG.md needed hand resolution — this branch's Antigravity entries now sit in main's 0.60.4 — Unreleased section; docs/antigravity.md, AntigravityProviderDescriptor.swift, and ProviderArchitectureGatekeeperTests.swift merged cleanly with both sides' changes kept. Follow-up eaabc0d1e re-pins the eight gatekeeper anchor line numbers that main's CLICostCommand.swift edits had shifted (anchor text unchanged).
  • Blocker 1 (current-build all-unpriced CLI evidence): added to the PR body — real CodexBarCLI cost --provider antigravity --days 1 text + JSON transcripts from a release build of the merged head, against a synthetic all-unpriced fixture DB with isolated GEMINI_CLI_HOME/TOKSCALE_CONFIG_DIR/CODEXBAR_CONFIG. Tokens and unpriced coverage render, no dollar estimate is invented, provenance stays unknown.
  • Blocker 2 (P1 native rendering): native menu-bar screenshots of the Plan Usage chart rendering the seeded observation histories while the provider is Offline (retained-history fallback), with the all-unpriced cost readout showing a dash instead of a dollar total. Hosted on the pr3619-evidence branch and embedded in the body. The chart-footnote disclaimer string remains CLI-only; the limitation is stated explicitly in the body rather than overclaimed.
  • CI: all checks green on eaabc0d1e (run 35057728895) — lint, both macOS test shards, all three Linux builds, changes, GitGuardian.
  • Local at the merged head: swiftformat 0/2300 changed, swiftlint --strict 0 violations, swift test --filter 'Antigravity' exit 0, focused touched-suite run 309 tests/14 suites green after the anchor re-pin (gatekeeper 41/41).

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 18, 2026
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)
@steipete

Copy link
Copy Markdown
Owner

Thanks @hhh2210. We adopted the quota-history portion in #3856 (da627ae534b6), retaining contributor credit. Fallback balances now survive missing cadence, same-hour replenishment, delayed responses, account-history adoption, and persistence. Explicit structured summaries keep their existing peak semantics. The original regressions failed before the change; all 420 focused tests now pass, make check is clean, and synthetic production-chart captures show the before/after behavior. Most API-pricing functionality already landed in #3757, so this patch retains the shared catalog implementation. The remaining pricing-policy and legacy-chart disclosure differences are recorded for maintainer follow-up. #3856 landed on main via #3867.

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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants