Port upstream 0.64.0: Antigravity cost follow-ups - lower bounds, withheld reads, --refresh (stacked on #610) - #706
Conversation
…held reads, --refresh) Partial Antigravity history never replaces a previously complete read, contradicted or budget-truncated reads are withheld, and trustworthy partial reads are published as lower bounds (tokensAreLowerBound / costIsLowerBound). Adds cost --provider antigravity --refresh for one bounded pricing refresh; routine reads never download pricing. Ports upstream steipete/CodexBar PR steipete#3757 (7eebfd4) in part.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…icing in the background Resolve the usage_spend.rs, usageSpendSharing, UsageSpendTab, cost.rs, local_history.rs and local_sqlite_tests.rs conflicts against #610 at 15f1091 (localized known-subtotal label, tray-panel-only main). Review fixes: - Routine reads (desktop Usage & Spend, serve /cost) now start one bounded models.dev refresh in the background when the history records a model with no known public price, as upstream 0.64 does; the next read reprices. - Pricing refresh targets route each unpriced model and its routing base through the same models.dev providers a rescan prices from (google for Gemini, openai for GPT, anthropic for Claude) instead of anthropic only. - docs/CLI.md no longer calls Antigravity cost token-history only. - Translate the upstream routine-read and explicit-refresh scenarios.
|
Lane A review: fixes at 317d4fe Merged #610 at 15f1091 into the branch (no rebase) and resolved the conflicts in Defects found and fixed:
Tests added: Validation at 317d4fe:
Checked with no change needed: locale keys (the Remaining deviations are listed in the PR body with Windows design notes: no dated price tables (b), no immutable-retry "unstable evidence" check (c), no general TTL catalog refresh when every model is priced, no background download from a plain |
UI proof (browser-use)Head: 317d4fe. Built from that commit with Setup
Screenshots are kept locally in the proof kit (
Not covered in the UI
The PR stays a draft for the maintainer. |
Found by the 0.60.4-0.69.0 port gap audit (entry G3, "Antigravity cost follow-ups not in #610"). Stacked on #610 (
codex/integrate-reviewed-ports-20260923); #610 at 15f1091 is merged in.Summary
Antigravity local cost history is never shown as exact when the read was incomplete or contradicted, and unknown-model pricing is refreshed the way upstream 0.64 does it: in the background for routine reads, and blocking for
codexbar cost --refresh.Upstream reference
CodexBar v0.64.0, steipete/CodexBar PR steipete#3757 (commit 7eebfd4):
AntigravityLocalReader,CostUsageFetcher(refreshPricingInBackground || !forceRefresh),CLICostCommand,AntigravityPricingRefreshTests,docs/cli.md.Ported / Deferred
Ported:
tokensAreLowerBoundandcostIsLowerBound; CLI text says "at least N"; the Usage & Spend row and the share PNG render≥N tokensnext to the existing localized≥$X knownsubtotal. A lower bound is never presented as an exact total, andtotal_usdstays null.serve /coststart one bounded models.dev refresh in the background (upstream app andserve), and the next read picks up the prices. Empty, absent or fully priced history starts no download.codexbar cost --provider antigravity --refreshwaits for that refresh and rescans (upstream--refresh). The rescan is kept only when it is at least as complete as the first scan.-tiered/-low/-thinkingrouting variant, grouped by models.dev provider (googlefor Gemini,openaifor GPT,anthropicfor Claude). The request carries no account identity or usage data; a failure leaves the models unpriced.LocalTokenHistorySummaryandLocalCostEstimatemoved torust/src/spend_contract/local_history.rssospend_contract.rsstays under 1000 lines. The unpriced model names are local-only (#[serde(skip)]), never part of the wire contract.Deferred, with Windows design notes:
refreshIfNeededfor fully priced history. Win's models.dev lookups return nothing once the cached catalog is stale, so those models become unpriced and take the targeted refresh above; models priced by the bundled table need no download.codexbar cost. Windows design note: upstream's CLI also starts a background refresh without--refresh, but the process exits right after printing, so Win starts no download there and documents--refreshinstead.Validation
At 317d4fe:
cargo +1.98.0 fmt --all --check: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: cleancargo +1.98.0 test -p codexbar: 2246 passed, 0 failed, 1 ignoredcargo +1.98.0 test -p codexbar-desktop-tauri: 478 passed, 1 failed. The failure isbootstrap_payload_exposes_every_provider_variant, which reads the machine's real settings (Isolate bootstrap payload test from real settings #684, hermetic fix in Make the bootstrap catalog test hermetic (#684) #711); it is unrelated to this change.pnpm install --frozen-lockfile,pnpm run check-locale(875 keys OK),pnpm run lint(clean),pnpm test(401 passed in 66 files),pnpm run build: all ok≥token formatting.Affected areas
rust/src/providers/antigravity/(SQLite and tokscale JSONL readers, cost estimate, refresh targeting, history retention)rust/src/spend_contract/(local history summary and JSON contract)rust/src/cli/cost.rs(--refresh, lower-bound text),rust/src/cli/serve/data.rs(/costbackground refresh)rust/src/core/cost_pricing/claude.rs,rust/src/core/claude_routed_pricing.rs(routed models.dev targets, crate-internal)apps/desktop-tauri/src-tauri/src/commands/usage_spend.rs,apps/desktop-tauri/src/lib/usageSpendSharing.ts,apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx,apps/desktop-tauri/src/types/bridge.tsdocs/CLI.mdUI proof
UI proof (browser-use) at 317d4fe: #706 (comment)
≥.≥$3.00 known · ≥600,000 tokensand≥$6.00 known · ≥1,200,000 tokens.auto, and no email or account text.serverefresh paths. Unit tests cover them.