Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Antigravity 2 Gemini 3.5 Flash tracking#377

Merged
iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/antigravity-gemini-35-flash
May 22, 2026
Merged

Fix Antigravity 2 Gemini 3.5 Flash tracking#377
iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/antigravity-gemini-35-flash

Conversation

@ozymandiashh
Copy link
Copy Markdown
Contributor

@ozymandiashh ozymandiashh commented May 22, 2026

Summary

Closes #376 by making CodeBurn see Antigravity 2 app usage again and by adding Gemini 3.5 Flash model aliases for the labels Antigravity can emit.

The main provider bug was discovery: CodeBurn 0.9.10 only looked for legacy Antigravity *.pb conversation files under ~/.gemini/antigravity/conversations, but Antigravity 2 app sessions on this setup are stored as SQLite *.db files. That meant the Antigravity provider could report no usage even while the Antigravity app had local session data and a live language-server RPC endpoint with token metadata.

This PR also handles Gemini 3.5 Flash high/medium/low labels by pricing them as the base gemini-3.5-flash model and displaying them as Gemini 3.5 Flash.

Root cause

Antigravity has two different local storage shapes now:

Antigravity app:
  ~/.gemini/antigravity/conversations/<cascade-id>.db

Legacy / older path:
  ~/.gemini/antigravity/conversations/<cascade-id>.pb

The existing provider discovered only this shape:

if (!file.endsWith('.pb')) continue

On Antigravity 2, the app conversations were present as .db files, so CodeBurn never created session sources for them. No source meant no call to GetCascadeTrajectoryGeneratorMetadata, even though the live Antigravity language server could resolve those .db cascade ids and return model/token usage.

A second bug was model normalization. Antigravity can surface thinking-level labels such as:

gemini-3.5-flash-high
gemini-3.5-flash-medium
gemini-3.5-flash-low
Gemini 3.5 Flash (High)

Those variants were not mapped to the priced LiteLLM key gemini-3.5-flash, so they could show as unknown or $0 if returned by the provider.

What changed

  • Discover Antigravity 2 *.db conversation files alongside legacy *.pb files.
  • Keep discovery strict to actual conversation files:
    • includes .db / .pb
    • excludes sidecars such as .db-wal
    • excludes directories
    • handles uppercase extensions such as .DB
  • Add antigravityCascadeIdFromPath() so both .db and .pb sources produce the same clean cascade id used by the RPC call.
  • Update Antigravity cache pruning to use the same .db / .pb cascade-id helper instead of basename(path, '.pb').
  • Parse Antigravity app_data_dir from language-server process args.
  • Cache and select live Antigravity servers by app data dir, so app sources and antigravity-cli sources do not get mixed.
  • Resolve Antigravity 2 --https_server_port 0 by matching the language-server PID and then asking lsof for its actual listener port.
  • Add best-effort discovery for antigravity-cli *.pb sources, while avoiding fabricated historical cost data when those files cannot expose token usage locally.
  • Add Gemini 3.5 Flash high/medium/low pricing aliases and display names in shared model handling and provider display maps.

Behavior proof

I reproduced the user-visible failure with CodeBurn 0.9.10 and Antigravity data present locally.

Before this PR, the released CLI did not surface Antigravity model usage:

codeburn models --provider antigravity --period all --format markdown --min-cost 0 --top 20

No model usage found for the selected period.

After this PR, with Antigravity 2.0.1 running and a fresh CodeBurn cache, the same provider path discovers the .db conversations and returns Antigravity rows:

| Provider | Model | Top Task | Input | Output | Cache Write | Cache Read | Total | Cost |
| --- | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Antigravity | `Opus 4.6` | Conversation (100%) | 393.1K | 13.8K | 0 | 0 | 406.9K | €1.99 |
| Antigravity | `Gemini 3 Flash` | Conversation (100%) | 347.5K | 18.4K | 0 | 0 | 365.9K | €0.197 |
|  | **Total** |  | **740.6K** | **32.2K** | **0** | **0** | **772.8K** | **€2.19** |

That proves the broken discovery path is fixed: CodeBurn now reaches the live Antigravity RPC metadata for Antigravity 2 .db sessions instead of reporting no usage.

Gemini 3.5 Flash notes

The local Antigravity app .db sessions available during validation currently returned Opus 4.6 and Gemini 3 Flash from the Antigravity RPC. The Gemini 3.5 Flash High usage observed on this machine is from agy / antigravity-cli.

The CLI data currently appears as binary .pb conversation files and logs/settings that show the selected label, but do not expose local token usage fields in a readable JSON/SQLite shape. This PR therefore does not invent historical CLI costs from label-only data.

What this PR does for Gemini 3.5 Flash:

  • if the Antigravity RPC returns gemini-3.5-flash-high, gemini-3.5-flash-medium, or gemini-3.5-flash-low, CodeBurn prices it as gemini-3.5-flash;
  • display names collapse those thinking variants to Gemini 3.5 Flash;
  • label-style names such as Gemini 3.5 Flash (High) also resolve to gemini-3.5-flash;
  • antigravity-cli sources are discovered best-effort, but routed only to an antigravity-cli live server if one is available, not incorrectly sent to the Antigravity app server.

Tests added

  • Antigravity 2 port-zero parsing.
  • app_data_dir normalization for app and CLI process args, including Windows-style paths.
  • Source-path routing for app vs antigravity-cli paths.
  • Cascade id derivation from both legacy .pb and Antigravity 2 .db files.
  • Discovery of .pb, .db, and uppercase .DB files while excluding .db-wal sidecars and directories.
  • Gemini 3.5 Flash high/medium/low Antigravity display names.
  • Gemini 3.5 Flash pricing aliases and non-zero cost calculation for high-thinking labels.

Validation

  • npm test -- --run tests/providers/antigravity.test.ts tests/models.test.ts - 102 tests passed.
  • npm run build - passed.
  • npm test -- --run - 65 files / 909 tests passed.
  • git diff --check - passed.
  • Fresh-cache behavior proof with Antigravity 2.0.1 running - Antigravity provider now returns model rows instead of No model usage found for the selected period.
  • Argus-adapted strict review - PASS, no blocking findings.
  • Claude Opus 4.7 --effort max review - PASS conditional; I added the requested app_data_dir and source-routing tests.
  • agy Gemini 3.5 Flash High review - PASS; I addressed the case-insensitive extension note.

Scope and privacy notes

  • The proof uses aggregate model/token/cost rows only.
  • No private prompts, local transcript contents, CSRF tokens, project names, or raw Antigravity conversation payloads are included.
  • This PR intentionally does not fabricate costs for antigravity-cli history when the local files expose only binary conversation data and label-only logs/settings.
  • Historical antigravity-cli token accounting may need a follow-up if Antigravity exposes a stable local SQLite/JSON token source or a persistent CLI RPC endpoint for those cascade ids.

@iamtoruk iamtoruk merged commit d0f1f82 into getagentseal:main May 22, 2026
3 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.

Antigravity 2 / Gemini 3.5 Flash usage is not surfaced in CodeBurn

2 participants