Repository navigation
fix(dashboard): show API-Key-compatible providers in Antigravity CLI Tools model picker - #4503
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request integrates model aliases into the AntigravityToolCard component, allowing custom OpenAI- and Anthropic-compatible providers to appear in the model selection modal. It also introduces a corresponding unit test file to verify this integration. The review feedback highlights a potential issue in the fetchModelAliases function, where res.json() is called before verifying res.ok, which could lead to unhandled parsing errors if the API returns a non-JSON error response.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const fetchModelAliases = async () => { | ||
| try { | ||
| const res = await fetch("/api/models/alias"); | ||
| const data = await res.json(); | ||
| if (res.ok) setModelAliases(data.aliases || {}); | ||
| } catch (error) { | ||
| console.log("Error fetching model aliases:", error); | ||
| } | ||
| }; |
There was a problem hiding this comment.
In fetchModelAliases, res.json() is called before verifying if the response is successful (res.ok). If the server returns a non-JSON error response (such as an HTML error page from a gateway or proxy), calling res.json() will throw a parsing error.
To prevent this and maintain consistency with fetchStatus and loadSavedMappings in the same file, check res.ok before attempting to parse the response body.
| const fetchModelAliases = async () => { | |
| try { | |
| const res = await fetch("/api/models/alias"); | |
| const data = await res.json(); | |
| if (res.ok) setModelAliases(data.aliases || {}); | |
| } catch (error) { | |
| console.log("Error fetching model aliases:", error); | |
| } | |
| }; | |
| const fetchModelAliases = async () => { | |
| try { | |
| const res = await fetch("/api/models/alias"); | |
| if (res.ok) { | |
| const data = await res.json(); | |
| setModelAliases(data.aliases || {}); | |
| } | |
| } catch (error) { | |
| console.log("Error fetching model aliases:", error); | |
| } | |
| }; |
cf91b1a to
667e6b3
Compare
…Tools model picker The API-Key-compatible / passthrough provider groups in `ModelSelectModal` are derived from the user's `modelAliases` map (fetched from `/api/models/alias`). `AntigravityToolCard` was the only CLI tool card that didn't fetch them or forward the `modelAliases` prop, so a custom OpenAI-compatible provider added in OmniRoute never surfaced in the Antigravity tool's model picker — routing a custom model to Antigravity from there was impossible. The card now mirrors the pattern already used by every sibling tool card (Codex, Claude, Cline, Kilo, Droid, OpenClaw, HermesAgent): - new `modelAliases` state - `fetchModelAliases()` called when the card is expanded - `modelAliases` forwarded to `<ModelSelectModal>` A source-level parity test guards the wiring so a future refactor can't silently drop the prop again. Co-authored-by: maskeen <maskeensingh@protonmail.com> Inspired-by: decolua/9router#241
667e6b3 to
e241c60
Compare
Rebuilt onto release/v3.8.33; reconciled with #4503 (kept fetchModelAliases) — sudo gating now uses server-reported isWin/needsSudoPassword instead of browser UA. Integrated into release/v3.8.33.
…Tools model picker (cheaper-inference#4503) Rebuilt onto release/v3.8.33 (squash-base-stale). Integrated into release/v3.8.33.
…per-inference#4514) Rebuilt onto release/v3.8.33; reconciled with cheaper-inference#4503 (kept fetchModelAliases) — sudo gating now uses server-reported isWin/needsSudoPassword instead of browser UA. Integrated into release/v3.8.33.
Summary
The API-Key-compatible / passthrough provider groups in
ModelSelectModalare derived from the user'smodelAliasesmap (fetched from/api/models/alias).AntigravityToolCardwas the only CLI tool card that didn't fetch them or forward themodelAliasesprop, so a custom OpenAI-compatible provider added in OmniRoute never surfaced in the Antigravity tool's model picker — routing a custom model to Antigravity from there was impossible.The card now mirrors the pattern already used by every sibling tool card (Codex, Claude, Cline, Kilo, Droid, OpenClaw, HermesAgent).
Changes
AntigravityToolCard.tsx: addmodelAliasesstate,fetchModelAliases()call on expand, and forward the prop to<ModelSelectModal>(+16 / -0).tests/unit/ui/AntigravityToolCard-model-aliases.test.tsx: source-level parity test guarding the wiring (3 assertions: state, fetch call, prop on the modal). RED before fix, GREEN after.CHANGELOG.md: entry under[3.8.32] → 🐛 Fixed.Test plan
npx vitest run tests/unit/ui/AntigravityToolCard-model-aliases.test.tsx— 3/3 passnpm run typecheck:core— clean (exit 0)eslint AntigravityToolCard.tsx— 0 errors, 1 warning (pre-existingreact-hooks/exhaustive-depson the same useEffect; unrelated to this change)node scripts/check/check-docs-sync.mjs— PASS (41 locales validated)