Skip to content

fix: add gemini-omni-flash-preview model alias + fix tool schema loss - #1

Closed
patoangolano wants to merge 1 commit into
luckdevx:mainfrom
patoangolano:main
Closed

patoangolano wants to merge 1 commit into
luckdevx:mainfrom
patoangolano:main

Conversation

@patoangolano

Copy link
Copy Markdown

Problem

When selecting a model like gemini-omni-flash-preview, the plugin returns a 404 error from the Google Antigravity API, along with Tool Debug Missing: 1 in the debug info.

Requested Model: gemini-omni-flash-preview
Effective Model: gemini-omni-flash-preview
Endpoint: https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse
Status: 404
Tool Debug Missing: 1
Tool Debug Summary: idx=0, hasCustom=true, customSchema=true, hasFunction=false, functionSchema=false

Root Cause

Bug 1: Model 404 — Missing alias

gemini-omni-flash-preview is not present in MODEL_ALIASES in model-resolver.ts. When a model name isn't found in the alias map, the resolver falls back to the raw model name (baseName), which the Google API rejects with 404 because no such model exists upstream.

Bug 2: Tool schema loss — toolDebugMissing: 1

In normalizeGeminiTools() (transform/gemini.ts), when a tool only has a function field (no custom), the code:

  1. Creates a custom wrapper with input_schema (line 297-304)
  2. Deletes the custom wrapper (line 332)

But if function.input_schema was never set (line 287 condition not met), the tool ends up with no schema at all after custom is deleted. The wrapToolsAsFunctionDeclarations() function downstream then uses an empty { type: "OBJECT", properties: {} } fallback, causing the toolDebugMissing counter to increment.

Fix

Fix 1: model-resolver.ts

Added marketing aliases mapping to real API model names:

"gemini-omni-flash-preview": "gemini-3-flash",
"gemini-omni-flash": "gemini-3-flash",
"gemini-omni-pro-preview": "gemini-3-pro",
"gemini-omni-pro": "gemini-3-pro",

Fix 2: transform/gemini.ts

Ensured function.input_schema is always populated before custom is stripped:

  • Added else if branch to set a fallback empty schema on function when source had no schema
  • Moved the schema assignment logic to be more defensive — function tools now always carry their schema even after custom deletion

Testing

  • gemini-omni-flash-preview now resolves to gemini-3-flash (valid API model)
  • Tools with only function field now retain their schema through the normalization pipeline
  • toolDebugMissing should be 0 for tools that have a proper schema

Files Changed

  • src/plugin/transform/model-resolver.ts — added 4 model aliases
  • src/plugin/transform/gemini.ts — fixed schema assignment order in normalizeGeminiTools()

Two bugs fixed:

1. Model 404: 'gemini-omni-flash-preview' was not in MODEL_ALIASES,
   causing fallback to raw model name which Google API rejects (404).
   Added mapping to gemini-3-flash (the actual API model name).

2. Tool schema missing (toolDebugMissing: 1): normalizeGeminiTools()
   created a 'custom' wrapper with input_schema but deleted it at line
   332 without ensuring function.input_schema was set first. Now
   function.input_schema is always populated before custom is stripped,
   and a fallback empty schema is added if source had none.
Copilot AI lite review requested due to automatic review settings August 12, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Gemini transform pipeline to (1) add marketing-name model aliases and (2) make tool schema normalization more defensive so tools don’t lose their schema during Gemini-specific reshaping.

Changes:

  • Added gemini-omni-* marketing aliases to the model alias resolver.
  • Adjusted normalizeGeminiTools() ordering/logic so function tools retain input_schema even when temporary custom wrappers are created and later stripped.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/plugin/transform/model-resolver.ts Adds marketing aliases for gemini-omni-* names to resolve to upstream Gemini 3 models.
src/plugin/transform/gemini.ts Updates tool normalization to ensure function.input_schema is set before temporary custom wrappers are created/removed.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 286 to 298
// Always update function.input_schema with transformed schema
// CRITICAL: This must happen BEFORE custom creation so function tools
// keep their schema even after custom is stripped (line 332).
if (newTool.function && schema) {
(newTool.function as Record<string, unknown>).input_schema = schema;
} else if (newTool.function && !schema) {
// Ensure function always has a schema even if source had none
(newTool.function as Record<string, unknown>).input_schema = {
type: "OBJECT",
properties: {},
};
toolDebugMissing += 1;
}
Comment on lines +51 to +55
// Marketing aliases - map to real API model names
"gemini-omni-flash-preview": "gemini-3-flash",
"gemini-omni-flash": "gemini-3-flash",
"gemini-omni-pro-preview": "gemini-3-pro",
"gemini-omni-pro": "gemini-3-pro",
Comment on lines +52 to +55
"gemini-omni-flash-preview": "gemini-3-flash",
"gemini-omni-flash": "gemini-3-flash",
"gemini-omni-pro-preview": "gemini-3-pro",
"gemini-omni-pro": "gemini-3-pro",
@patoangolano patoangolano closed this by deleting the head repository Sep 25, 2026
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.

2 participants