Skip to content

v6.8.30#392

Merged
luispater merged 7 commits intomainfrom
plus
Feb 26, 2026
Merged

v6.8.30#392
luispater merged 7 commits intomainfrom
plus

Conversation

@luispater
Copy link

No description provided.

sususu98 and others added 6 commits February 23, 2026 13:38
…and unify mimeType

Move base64 image data from Claude tool_result into functionResponse.parts
as inlineData instead of outer sibling parts, preventing context bloat.
Unify all inlineData field naming to camelCase mimeType across Claude,
OpenAI, and Gemini translators. Add comprehensive edge case tests and
Gemini-side regression test for functionResponse.parts preservation.
fix(antigravity): place tool_result images in functionResponse.parts and unify mimeType
…fallback

fix(antigravity): keep primary model list and backfill empty auths
@gemini-code-assist
Copy link

Summary of Changes

Hello @luispater, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant improvements to how Antigravity models are managed and how image data is handled in tool results for Claude models. A new caching layer ensures greater resilience by providing fallback model lists during network issues. The Claude translator now intelligently processes image content within tool results, optimizing the data structure for better context management. Additionally, a new mechanism allows for efficient propagation of model lists to newly registered Antigravity authentications, and static model definitions have been updated.

Highlights

  • Antigravity Model Caching: Implemented a caching mechanism for Antigravity primary model lists, allowing the system to return cached models on fetch failures and store successfully retrieved non-empty lists.
  • Claude Tool Result Image Handling: Enhanced the Claude request translator to correctly embed base64 image data from tool_result content into functionResponse.parts as inlineData, preventing text context bloat in response.result.
  • Antigravity Model Backfilling: Introduced a feature to backfill model lists for Antigravity authentications that haven't registered models yet, using a primary model list from another active Antigravity auth.
  • Model Definition Updates: Removed several outdated or deprecated model entries from the static model definitions.
  • Consistency in mimeType Field: Standardized the mimeType field name in inlineData across Claude and OpenAI translators for better consistency.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • internal/registry/model_definitions_static_data.go
    • Removed several model definitions including "tstars2.0", "kimi-k2-0905", "glm-4.7", "glm-5", "kimi-k2-thinking", "deepseek-v3.2-chat", "deepseek-v3.2-reasoner", "minimax-m2", "minimax-m2.1", "minimax-m2.5", and "kimi-k2.5".
  • internal/runtime/executor/antigravity_executor.go
    • Added antigravityPrimaryModelsCache with sync.RWMutex for thread-safe caching of model lists.
    • Implemented cloneAntigravityModels and cloneAntigravityModelInfo for deep copying model information.
    • Added storeAntigravityPrimaryModels, loadAntigravityPrimaryModels, and fallbackAntigravityPrimaryModels to manage the model cache.
    • Modified FetchAntigravityModels to use the cache: returning cached models on errors or empty fetches, and storing successful non-empty fetches.
  • internal/runtime/executor/antigravity_executor_models_cache_test.go
    • Added resetAntigravityPrimaryModelsCacheForTest helper function.
    • Added TestStoreAntigravityPrimaryModels_EmptyDoesNotOverwrite to verify cache behavior with empty lists.
    • Added TestLoadAntigravityPrimaryModels_ReturnsClone to ensure loaded models are deep copies.
  • internal/translator/antigravity/claude/antigravity_claude_request.go
    • Updated ConvertClaudeRequestToAntigravity to handle tool_result content: if functionResponseResult is an array, base64 images are extracted and placed into functionResponse.parts as inlineData, while non-image content forms the response.result. If functionResponseResult is a single object and a base64 image, it's moved to functionResponse.parts as inlineData, and response.result is set to empty.
    • Changed mime_type to mimeType in inlineData for consistency.
  • internal/translator/antigravity/claude/antigravity_claude_request_test.go
    • Updated TestConvertClaudeRequestToAntigravity_ImageContent to reflect mimeType change.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultWithImage for array content with text and image.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultWithSingleImage for single image object content.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultWithMultipleImagesAndTexts for mixed content.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultWithOnlyMultipleImages for image-only array content.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultImageNotBase64 to test non-base64 images.
    • Added TestConvertClaudeRequestToAntigravity_ToolResultImageMissingData and TestConvertClaudeRequestToAntigravity_ToolResultImageMissingMediaType for edge cases in image data.
  • internal/translator/antigravity/gemini/antigravity_gemini_request_test.go
    • Added TestFixCLIToolResponse_PreservesFunctionResponseParts to ensure functionResponse.parts are maintained.
  • internal/translator/antigravity/openai/chat-completions/antigravity_openai_request.go
    • Standardized mime_type field name to mimeType in inlineData for OpenAI request translation.
  • sdk/cliproxy/service.go
    • Added backfillAntigravityModels method to register models for other Antigravity authentications if they are missing.
    • Integrated backfillAntigravityModels call within registerModelsForAuth for Antigravity providers.
  • sdk/cliproxy/service_antigravity_backfill_test.go
    • Added TestBackfillAntigravityModels_RegistersMissingAuth to verify model backfilling for new auths.
    • Added TestBackfillAntigravityModels_RespectsExcludedModels to ensure excluded models are honored during backfill.
Activity
  • No human activity was recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several enhancements for robustness and user experience, primarily for the "antigravity" provider. Key changes include adding a caching and fallback mechanism for model discovery to improve resilience against endpoint failures, and a backfill feature to share a successfully fetched model list across all antigravity accounts. The PR also refactors how image content within Claude tool results is handled to optimize context usage and corrects the mime_type field to mimeType for consistency across translators. The changes are well-supported by new tests. My review includes one suggestion to refactor duplicated code in the Claude translator for better maintainability.

Comment on lines 224 to +284
} else if functionResponseResult.IsArray() {
frResults := functionResponseResult.Array()
if len(frResults) == 1 {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", frResults[0].Raw)
nonImageCount := 0
lastNonImageRaw := ""
filteredJSON := "[]"
imagePartsJSON := "[]"
for _, fr := range frResults {
if fr.Get("type").String() == "image" && fr.Get("source.type").String() == "base64" {
inlineDataJSON := `{}`
if mimeType := fr.Get("source.media_type").String(); mimeType != "" {
inlineDataJSON, _ = sjson.Set(inlineDataJSON, "mimeType", mimeType)
}
if data := fr.Get("source.data").String(); data != "" {
inlineDataJSON, _ = sjson.Set(inlineDataJSON, "data", data)
}

imagePartJSON := `{}`
imagePartJSON, _ = sjson.SetRaw(imagePartJSON, "inlineData", inlineDataJSON)
imagePartsJSON, _ = sjson.SetRaw(imagePartsJSON, "-1", imagePartJSON)
continue
}

nonImageCount++
lastNonImageRaw = fr.Raw
filteredJSON, _ = sjson.SetRaw(filteredJSON, "-1", fr.Raw)
}

if nonImageCount == 1 {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", lastNonImageRaw)
} else if nonImageCount > 1 {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", filteredJSON)
} else {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", functionResponseResult.Raw)
functionResponseJSON, _ = sjson.Set(functionResponseJSON, "response.result", "")
}

// Place image data inside functionResponse.parts as inlineData
// instead of as sibling parts in the outer content, to avoid
// base64 data bloating the text context.
if gjson.Get(imagePartsJSON, "#").Int() > 0 {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "parts", imagePartsJSON)
}

} else if functionResponseResult.IsObject() {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", functionResponseResult.Raw)
if functionResponseResult.Get("type").String() == "image" && functionResponseResult.Get("source.type").String() == "base64" {
inlineDataJSON := `{}`
if mimeType := functionResponseResult.Get("source.media_type").String(); mimeType != "" {
inlineDataJSON, _ = sjson.Set(inlineDataJSON, "mimeType", mimeType)
}
if data := functionResponseResult.Get("source.data").String(); data != "" {
inlineDataJSON, _ = sjson.Set(inlineDataJSON, "data", data)
}

imagePartJSON := `{}`
imagePartJSON, _ = sjson.SetRaw(imagePartJSON, "inlineData", inlineDataJSON)
imagePartsJSON := "[]"
imagePartsJSON, _ = sjson.SetRaw(imagePartsJSON, "-1", imagePartJSON)
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "parts", imagePartsJSON)
functionResponseJSON, _ = sjson.Set(functionResponseJSON, "response.result", "")
} else {
functionResponseJSON, _ = sjson.SetRaw(functionResponseJSON, "response.result", functionResponseResult.Raw)
}

Choose a reason for hiding this comment

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

medium

There is significant code duplication in how image parts are processed within the IsArray and IsObject conditions. The logic to construct inlineDataJSON and imagePartJSON is nearly identical in both branches (lines 232-242 and 268-277). To improve maintainability and reduce redundancy, consider refactoring this shared logic. A local helper function (closure) could encapsulate this logic, making the code cleaner and easier to manage.

@luispater luispater merged commit d310008 into router-for-me:main Feb 26, 2026
1 of 2 checks passed
@luispater luispater deleted the plus branch February 26, 2026 15:16
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.

3 participants