Skip to content

fix(kiro): add open-weight model mappings to mapModelToKiro#440

Closed
andromedarabbit wants to merge 1 commit intorouter-for-me:mainfrom
andromedarabbit:fix/kiro-open-weight-model-routing
Closed

fix(kiro): add open-weight model mappings to mapModelToKiro#440
andromedarabbit wants to merge 1 commit intorouter-for-me:mainfrom
andromedarabbit:fix/kiro-open-weight-model-routing

Conversation

@andromedarabbit
Copy link

Summary

Fixes #429

Open-weight models (DeepSeek, MiniMax, Qwen3 Coder, GPT) were defined in GetKiroModels() but missing from mapModelToKiro(), causing them to silently fall back to claude-sonnet-4.5 instead of routing to the correct backend model.

Root Cause

mapModelToKiro() in kiro_executor.go has a hardcoded modelMap that only contained Claude models and auto. When a user selected e.g. kiro-deepseek-3-2, the model name:

  1. Failed the static map lookup
  2. Failed all Claude-specific pattern checks (haiku/sonnet/opus)
  3. Hit the final fallback → claude-sonnet-4.5 (wrong model sent to API)

The model definitions were added in commits 09cd3cff and 37a09ecb to model_definitions.go, but the corresponding routing in mapModelToKiro() was never updated.

Changes

internal/runtime/executor/kiro_executor.go

  • Added static mappings for all open-weight models to mapModelToKiro():
    • DeepSeek 3.2 (kiro-, native hyphen, native dot formats + agentic variants)
    • MiniMax M2.1 (kiro-, native hyphen, native dot formats + agentic variants)
    • Qwen3 Coder Next (kiro-, native formats + agentic variants)
    • GPT-4o, GPT-4, GPT-4 Turbo, GPT-3.5 Turbo (kiro-, native formats)
  • Added smart fallback patterns for deepseek, minimax, qwen, and gpt model families (after existing Claude fallbacks)

internal/runtime/executor/kiro_executor_test.go

  • Added TestMapModelToKiro_OpenWeightModels — 24 test cases covering all model IDs and prefix formats
  • Added TestMapModelToKiro_FallbackPatterns — 11 test cases for smart fallback logic
  • Added TestMapModelToKiro_ExistingClaudeModels — 5 regression tests for existing Claude routing

Testing

All 40 new test cases pass. Full executor test suite passes with no regressions.

=== RUN   TestMapModelToKiro_OpenWeightModels (24/24 PASS)
=== RUN   TestMapModelToKiro_FallbackPatterns (11/11 PASS)
=== RUN   TestMapModelToKiro_ExistingClaudeModels (5/5 PASS)

Risk Assessment

  • Low risk: Changes are purely additive — only new map entries and fallback patterns
  • No breaking changes: Existing Claude model routing is completely untouched
  • Fail-fast: If API model IDs are incorrect, the API returns an error (better than silent fallback to wrong model)

DeepSeek, MiniMax, Qwen3 Coder, and GPT models were defined in
GetKiroModels() but missing from mapModelToKiro(), causing them
to silently fall back to claude-sonnet-4.5 instead of routing to
the correct backend model.

Adds static mappings for all open-weight models (kiro-, native,
and agentic variants) and smart fallback patterns for unknown
variants of each model family.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 resolves an issue where open-weight models were incorrectly defaulting to a Claude model due to missing explicit routing configurations. By introducing comprehensive mappings and intelligent fallback mechanisms, it ensures that DeepSeek, MiniMax, Qwen3 Coder, and GPT models are accurately directed to their intended backends. This enhancement significantly improves the reliability of model selection and prevents misrouting, all while maintaining backward compatibility and providing extensive test validation.

Highlights

  • Open-Weight Model Mappings: Added explicit static mappings for DeepSeek, MiniMax, Qwen3 Coder, and various GPT models within the mapModelToKiro() function to ensure correct routing.
  • Smart Fallback Patterns: Implemented new smart fallback logic for DeepSeek, MiniMax, Qwen, and GPT model families to handle unknown variants and prevent silent fallbacks to incorrect models.
  • Comprehensive Test Coverage: Introduced new unit tests covering 24 cases for open-weight model mappings, 11 cases for fallback patterns, and 5 regression tests for existing Claude model routing, ensuring robustness and preventing regressions.

🧠 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/runtime/executor/kiro_executor.go
    • Added explicit mappings for DeepSeek, MiniMax, Qwen3 Coder, and GPT models to the modelMap.
    • Introduced new strings.Contains based fallback logic for DeepSeek, MiniMax, Qwen, and GPT model families after existing Claude fallbacks.
  • internal/runtime/executor/kiro_executor_test.go
    • Added TestMapModelToKiro_OpenWeightModels with 24 test cases to verify direct open-weight model mappings.
    • Added TestMapModelToKiro_FallbackPatterns with 11 test cases to validate the new smart fallback logic.
    • Added TestMapModelToKiro_ExistingClaudeModels with 5 regression test cases to ensure existing Claude model routing remains functional.
Activity
  • All 40 newly added test cases for model mapping and fallback logic passed successfully.
  • The full executor test suite passed without any regressions, confirming the stability of the changes.
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 correctly addresses a bug where open-weight models were not being mapped correctly in mapModelToKiro, causing them to fall back to the wrong model. The changes add the necessary mappings and fallback logic for DeepSeek, MiniMax, Qwen, and GPT models. The addition of comprehensive test cases is also a great improvement.

My review identifies some redundant entries in both the model map and the corresponding test cases. Removing these duplicates will improve code clarity and maintainability. Otherwise, the changes look solid.

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.

Kiro open-weight models (MiniMax/DeepSeek) not supported since cliproxyapi 6.8.32

1 participant