Skip to content

Mirror: fix: override context window for MiniMax/Kimi free models (#5568)#9

Merged
jeremylongshore merged 6 commits intomainfrom
review/PR-5568
Feb 15, 2026
Merged

Mirror: fix: override context window for MiniMax/Kimi free models (#5568)#9
jeremylongshore merged 6 commits intomainfrom
review/PR-5568

Conversation

@jeremylongshore
Copy link
Copy Markdown
Owner

@jeremylongshore jeremylongshore commented Feb 14, 2026

Mirror of Kilo-Org#5568

Field Value
Upstream PR #5568
Author @romeoscript
Category fix
Tier 2
Size 6+/0- lines, 1 file

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

  • CodeRabbit reviewed
  • Gemini Code Assist reviewed
  • Greptile reviewed
  • CodeQL scanned
  • Qodo PR-Agent reviewed

Summary by CodeRabbit

  • Bug Fixes
    • Adjusted context window capacity for specific AI models to support larger inputs and improve handling of extended conversations.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @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

  • Context Window Override: The context window for 'minimax-2.1:free' and 'kimi-2.5:free' models within the OpenRouter provider has been explicitly set to 200,000 tokens to prevent aggressive truncation issues.
Changelog
  • src/api/providers/fetchers/openrouter.ts
    • Added logic to set the context window to 200,000 for 'minimax-2.1:free' and 'kimi-2.5:free' models.
Activity
  • The pull request was opened by jeremylongshore, mirroring an upstream PR from @romeoscript.
  • A bot review checklist was included in the PR description, with all items currently unchecked, indicating no automated or manual review activity has been recorded yet.
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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

A 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

Cohort / File(s) Summary
OpenRouter Context Window Enhancement
src/api/providers/fetchers/openrouter.ts
Added conditional logic to boost contextWindow to 200000 for minimax-2.1:free and kimi-2.5:free models in the parseOpenRouterModel function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through model land,
With context windows grand and grand,
Two models now can stretch and see,
Two hundred thousand tokens free,
Minimax and Kimi cheer with glee! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description deviates from the template by focusing on mirror metadata rather than the standard Context/Implementation/How to Test structure. Consider following the provided template with Context, Implementation, and How to Test sections instead of just bot review checklist metadata.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: overriding the context window for specific OpenRouter models (MiniMax/Kimi free variants).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch review/PR-5568

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

Copy link
Copy Markdown

@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 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.

Comment on lines +319 to +321
if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) {
modelInfo.contextWindow = 200000
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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
	}

@jeremylongshore jeremylongshore merged commit 31dc0a6 into main Feb 15, 2026
16 checks passed
@jeremylongshore jeremylongshore deleted the review/PR-5568 branch February 15, 2026 20:44
@jeremylongshore
Copy link
Copy Markdown
Owner Author

Review: kilocode Kilo-Org#5568

fix: override context window for MiniMax/Kimi free models by @romeoscript
Multi-AI analysis: Fork PR #9 — reviewed by CodeRabbit, Gemini, CodeQL, Qodo

Checklist

Check Result Notes
Correctness PASS Override follows established pattern in same function
Conventions PASS Uses kilocode_change markers correctly
Changeset MISSING Behavioral change to extension needs a changeset
Tests MISSING No test coverage for the override
i18n N/A No UI strings
Types PASS check-types passes (22/22 on Codespace)
Security N/A No security implications
Scope PASS Single file, single concern

Findings

🟡 Missing changeset

This 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 upstream

The upstream PR branch hotfix/context-window-override has no CI check results. The branch may need a rebase to trigger CI. Types pass on our Codespace (22/22).

id.includes() vs exact match

The existing overrides in this function use exact match (id === "openrouter/horizon-alpha"), but this PR uses id.includes("minimax-2.1:free"). The includes() approach is more flexible (handles different vendor prefixes) but less precise. Either approach works — just noting the inconsistency.

⚪ No test verifying the override

The existing model-specific overrides (horizon-alpha, horizon-beta, claude-haiku-4.5) also lack individual tests, so this is consistent with the codebase. But for a PR fixing a user-reported bug (Kilo-Org#5566), a test would strengthen confidence.

CI Status

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 end

Verdict

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).

@jeremylongshore
Copy link
Copy Markdown
Owner Author

Review Journal: kilocode Kilo-Org#5568

PR: #5568 |
Title: fix: override context window for MiniMax/Kimi free models |
Author: @romeoscript |
Category: fix | Tier: 2 | Size: 6 lines, 1 file | Confidence: 4/5

Multi-AI analysis: Fork PR #9 — CodeRabbit, Gemini, CodeQL, Qodo


Summary

A 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 parseOpenRouterModel(). Clean and correct, but needs a changeset and upstream CI hasn't run.

First Impressions

First tier 2 (code fix) PR in the pipeline. At 6 lines in 1 file, this is minimal — but it touches provider infrastructure (openrouter.ts), which is a high-traffic code path. The fix: prefix and linked issue (Kilo-Org#5566) set clear expectations.

What I Looked At

  1. The diff — 6 lines added to src/api/providers/fetchers/openrouter.ts
  2. Surrounding code — Lines 300-320 of same file, showing 3 existing model-specific overrides
  3. Issue [CRITICAL] Aggressive context condensation on free models (~130-150k → 21kB) via KiloCode API - total session loss Kilo-Org/kilocode#5566 — User report: context window indicator shows ~32k instead of 200k for these models
  4. PR description — Includes detailed reproduction steps and before/after verification
  5. Fork check-types — 22/22 pass (1 cache miss for kilo-code package, the one that changed)

Analysis

The fix is correct

The OpenRouter API reports incorrect context windows for MiniMax 2.1:free and Kimi 2.5:free. The fix overrides modelInfo.contextWindow to 200,000 after the API data is parsed, ensuring the extension uses the correct value for truncation decisions.

// kilocode_change start
if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) {
    modelInfo.contextWindow = 200000
}
// kilocode_change end

Pattern compliance

The parseOpenRouterModel() function already has 3 similar overrides:

Model Override Type
anthropic/claude-haiku-4.5 supportsReasoningBudget = true Capability
openrouter/horizon-alpha maxTokens = 32768 Limit
openrouter/horizon-beta maxTokens = 32768 Limit
minimax-2.1:free contextWindow = 200000 Limit
kimi-2.5:free contextWindow = 200000 Limit

The PR follows the established pattern. The kilocode_change markers are used correctly per project conventions.

Minor style note

Existing overrides use id === "exact/match" while this PR uses id.includes("partial"). The includes() approach handles different vendor prefixes (e.g., openrouter/minimax-2.1:free vs minimax/minimax-2.1:free) but is less precise. Both approaches are valid here.

Verification

Upstream CI         NOT RUN    (no checks on branch)
Fork check-types    PASS       (22/22, 36.6s, 1 cache miss)

The upstream branch hotfix/context-window-override has no CI results — likely needs a rebase to trigger the CI workflow. Our Codespace verification confirms types are clean.

Lessons Learned

1. 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 gh pr checks returns nothing, the branch may be stale or misconfigured. This is worth flagging in the review — maintainers may need to ask the contributor to rebase.

3. Model-specific overrides are a scaling concern. The pattern of hardcoding corrections for individual models in parseOpenRouterModel() works for 5 models but won't scale to 50. This is not a problem for this PR, but it's a pattern worth watching as more models are added.


Review #6 of 75 | Review methodology: AI PR Review Case Studies | Reviewed with GWI + Claude Code

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