Mirror: fix: override context window for MiniMax/Kimi free models (#5568)#9
Mirror: fix: override context window for MiniMax/Kimi free models (#5568)#9jeremylongshore merged 6 commits intomainfrom
Conversation
Enforces a 200k context window for and to prevent aggressive truncation caused by incorrect API limitations.
Summary of ChangesHello @jeremylongshore, 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 addresses an issue where specific free models from the OpenRouter provider were experiencing aggressive truncation due to an insufficient default context window. By overriding the context window for these models, the change ensures that they can process larger inputs without data loss, improving their usability and reliability. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
📝 WalkthroughWalkthroughA targeted enhancement to the OpenRouter model parser adds a post-processing rule that increases the context window to 200000 tokens for two specific free model variants: minimax-2.1:free and kimi-2.5:free. This override applies after standard horizon-based adjustments. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Code Review
This pull request overrides the context window for two free models on OpenRouter, minimax-2.1:free and kimi-2.5:free, to prevent aggressive truncation. The change is a targeted fix that hardcodes the context window to 200k for these models. While the fix seems correct, the implementation could be made more robust by using strict equality checks for model IDs instead of includes(), which I've detailed in a specific comment. This will improve maintainability and prevent potential bugs from incorrect model matching.
| if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) { | ||
| modelInfo.contextWindow = 200000 | ||
| } |
There was a problem hiding this comment.
Using id.includes() is less precise and could lead to accidentally matching incorrect models if their IDs contain these substrings. For consistency with other checks in this file and for improved robustness, it's better to use strict equality (===) with the full model IDs. Using numeric separators for large numbers also improves readability.
Assuming the full model IDs are minimax/minimax-2.1:free and moonshot/kimi-2.5:free, here is a suggested improvement. Please verify the full model IDs if they are different.
if (id === "minimax/minimax-2.1:free" || id === "moonshot/kimi-2.5:free") {
modelInfo.contextWindow = 200_000
}4231140 to
fa13626
Compare
Review: kilocode Kilo-Org#5568
Checklist
Findings🟡 Missing changesetThis PR modifies extension behavior (context window size affects truncation for MiniMax/Kimi users). A changeset should be added for the version bump. 🟡 No CI checks ran on upstreamThe upstream PR branch ⚪
|
| Check | Result |
|---|---|
| Upstream CI | NOT RUN (no checks on branch) |
| Fork check-types | PASS (22/22, 1 cache miss for kilo-code) |
Code Snippets
// src/api/providers/fetchers/openrouter.ts — existing pattern
if (id === "openrouter/horizon-beta") {
modelInfo.maxTokens = 32768
}
// PR addition — follows same pattern
// kilocode_change start
if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) {
modelInfo.contextWindow = 200000
}
// kilocode_change endVerdict
COMMENT - Clean 6-line fix following the established model-override pattern in parseOpenRouterModel(). The kilocode_change markers are correct. Two items need attention: (1) a changeset should be added since this changes extension behavior, and (2) upstream CI hasn't run — the branch may need a rebase to trigger checks. The fix itself is correct for the reported issue (Kilo-Org#5566).
Review Journal: kilocode Kilo-Org#5568
SummaryA targeted fix for issue Kilo-Org#5566: MiniMax 2.1 and Kimi 2.5 free models report incorrect context windows via the OpenRouter API, causing aggressive truncation. The fix hardcodes 200k context for these models, following an established override pattern in First ImpressionsFirst tier 2 (code fix) PR in the pipeline. At 6 lines in 1 file, this is minimal — but it touches provider infrastructure ( What I Looked At
AnalysisThe fix is correctThe OpenRouter API reports incorrect context windows for MiniMax 2.1:free and Kimi 2.5:free. The fix overrides // kilocode_change start
if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) {
modelInfo.contextWindow = 200000
}
// kilocode_change endPattern complianceThe
The PR follows the established pattern. The Minor style noteExisting overrides use VerificationThe upstream branch Lessons Learned1. First code fix review — new checklist items matter. For docs PRs, "changeset" and "tests" were N/A. For code fixes, both become relevant. The review checklist correctly surfaces these gaps. 2. Missing upstream CI is a red flag. When 3. Model-specific overrides are a scaling concern. The pattern of hardcoding corrections for individual models in Review #6 of 75 | Review methodology: AI PR Review Case Studies | Reviewed with GWI + Claude Code |
Mirror of Kilo-Org#5568
Changes
Overrides context window to 200k for minimax-2.1:free and kimi-2.5:free models in OpenRouter provider to prevent aggressive truncation.
Bot Review Checklist
Summary by CodeRabbit