Repository navigation
fix(antigravity): show a saved level model as its family and level in the chat composer - #48017
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Low Merge Risk:
|
… the chat composer A chat saved with an Antigravity level id such as `gemini-4-neon-high` showed "Gemini 4 Neon High High" because the saved id was kept as its own row next to the High effort. Agent definitions can now map saved options onto the chat's listing (`listedSelection`); Antigravity's dialect maps a level id to its listed family row and level when the listing offers both and does not list the id itself. The resting and live options reads apply it, and the stored record is left unchanged. Refs stablyai#47987 Co-authored-by: Jeff Zhang <[email protected]>
4287239 to
16bac3e
Compare
ELI5
An Antigravity chat saved with the model
gemini-4-neon-highshowed Gemini 4 Neon High High in the composer: once in the model name and again as the effort. Now it shows Gemini 4 Neon with High effort, and the effort picker lists that model's levels.What Changed
agylists each level as its own id (gemini-4-neon-high,-medium,-low), and Orca's listing groups them into onegemini-4-neonrow with efforts. A chat saved with the level id did not match any grouped row, so the composer kept the saved id as its own row, labeled it "Gemini 4 Neon High", and put the High effort next to it.gemini-4-neonrow withhighselected, and the next message sends that family and level.StructuredAgentDefinition.restingOptionsgets an optionallistedSelectionhook that maps saved options onto the chat's current listing. ACP dialects can provide it, and Antigravity's dialect providesantigravityListedFamilySelection(moved fromantigravity-model-listing.tsinto the dialect). It maps a level id to its family row and level only when the listing offers that family with that level (and the requested effort) and does not list the id itself. Both the resting options read and the live options read apply it. The stored session record stays unchanged, so nothing is rewritten on disk.Why
The bug comes from the saved selection not matching the listing, so the fix maps the selection where options are read instead of patching the label. That keeps the shown row, the effort control and the sent selection consistent. Agents without the hook behave exactly as before. A model the listing doesn't group (an unknown level id, or one
agylists as its own row) keeps its own row.This is a partial fix for the issue. It covers the composer display and selection for saved level ids. Orchestration-worker creation already normalizes the suffix (#46941).
Linked Issue
Fixes #47987
Refs #46913
Original fix by @zjffdu in #48017; final version reworked during the bug bash.
Reported by @jianfengzhang-maersk
Visual Proof
N/A for this reworked version: the owner's Mac is in active use, so no Electron run was done. The composer result goes through the real options read and the real option snapshot in
structured-agent-session-options-read.test.ts. The original before/after screenshots from #48017's description show the bug and the expected label:Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns (the "keeps a model the listing does not group" case is a guard and passes either way)
Repro: an
agy1.5.15 listing (gemini-4-neon-high/medium/low,gpt-oss-120b-medium) with a chat saved as{ model: 'gemini-4-neon-high' }, read through the real resting and live options readers with the real Antigravity definition.structured-agent-session-options-read.test.ts: the composer showsgemini-4-neon/highwith choiceslow, medium, highand sends{ model: 'gemini-4-neon', effort: 'high' }. An explicit saved effort wins. Ungrouped ids keep their own row. A live chat answers the family row and level assaved, and the stored record stays unchanged. With the read changes reverted, both mapping tests fail.antigravity-dialect.test.tsand the neighboring antigravity, resting-options and orchestration-worker suites: 14 files, 100 tests pass.oxlint, oxfmt, the anti-slop and native-plugin oxlint configs, ast-grep, and the changed-code quality gate are clean on the touched files.
Platforms: unit tests on macOS. The change is pure TypeScript logic with no OS-specific paths.
Performance
None. This adds one regex and a linear scan of the already-loaded model listing, and only when options are read, not per keystroke or per frame. Measured: 0.36 µs per call with a typical listing, 21 µs with 2,000 family rows and a miss, 14 µs with a 10,000-char saved id. There is no new I/O, subprocess or polling.
Risk
Level: Low
Only agents that define
listedSelection(only Antigravity today) change. If the mapping misfired, an Antigravity chat would show and send the family row plus level instead of the saved level id. That is the same pair the chat sends when a user picks that row and level in the composer. Saved records are not rewritten, and older paired clients and remote hosts get the same option payload shape. Back out with a plain revert.Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)