Skip to content

Fix Antigravity usage and cost collection - #261

Merged
aixle-com[bot] merged 7 commits into
developfrom
feature/fix-antigravity-usage
Sep 18, 2026
Merged

aixle-com[bot] merged 7 commits into
developfrom
feature/fix-antigravity-usage

Conversation

@aixle-com

@aixle-com aixle-com Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • parse cumulative token usage from Antigravity stream-json result events
  • expose the redacted terminal output artifact to adapter cleanup hooks
  • calculate API-equivalent cost from the selected Antigravity model pricing, including cache-read discounts
  • cover all 14 model IDs observed in the live Antigravity catalogue with fallback metadata and configured family pricing
  • warn when a newly introduced catalogue model lacks configured pricing instead of silently hiding the drift
  • persist usage through the shared accumulator for session, run, and project analytics
  • update Antigravity runtime documentation and add parser, pricing-coverage, persistence, ANSI-tolerance, and cleanup artifact tests

Why

antigravity_cli inherited the base no-op collect_usage, leaving completed session usage and analytics empty. The live catalogue can also add model IDs without exposing prices, so the adapter now makes unknown pricing visible in logs.

Pricing note

Antigravity exposes token counts but no pricing fields. Cost is an API-equivalent estimate based on configured public model-family rates; effort variants in the same family share those rates.

How to test

  • docker compose run --rm --entrypoint bin/rails -e RAILS_ENV=test web test test/services/agents/antigravity_cli_adapter_test.rb test/services/container_strategies/agent_session_strategy_test.rb
  • docker compose run --rm --entrypoint bundle web exec rubocop app/services/agents/antigravity_cli_adapter.rb test/services/agents/antigravity_cli_adapter_test.rb

@aixle-com aixle-com Bot left a comment

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.

Review verdict: changes required. GitHub does not allow this integration identity to formally request changes on its own PR; the two blocking findings are inline below.

aixle-com Bot added 2 commits September 15, 2026 11:16
Makes collect_usage idempotent across a cleanup retry (Accumulator.record
always increments, and the result event is already the run's cumulative
total, so a retry after any later cleanup failure would double every
value). Reverts the collect_terminal_output artifact-plumbing change in
the shared AgentSessionStrategy/WorkflowStepStrategy — collect_usage
already falls back to reading the persisted terminal_output.log SessionLog,
so no shared-strategy change is needed to reach it, removing blast radius
on every other adapter.

Also fixes session_command's non-interactive flag order: confirmed
against the real agy 1.1.27 binary that --print immediately followed by
another flag swallows it as literal prompt text instead of parsing it,
silently breaking every non-interactive Antigravity session.
…etry

The prior version reused the same in-memory TerminalSession across both
collect_usage calls, so the usage_statistic association never reflected
the first call's committed row and the guard never got exercised.

@aixle-com aixle-com Bot left a comment

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.

Updated-head review: no blocking code issues found. One non-blocking documentation recommendation is attached inline.

aixle-com Bot added 3 commits September 17, 2026 13:00
Add the observed low-tier model ids to fallback and pricing tables, surface unknown pricing in logs, and refresh the usage documentation.
@aixle-com
aixle-com Bot merged commit 4ca8fe7 into develop Sep 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant