Skip to content

fix: override context window for MiniMax/Kimi free models#5568

Merged
kevinvandijk merged 3 commits intoKilo-Org:mainfrom
romeoscript:hotfix/context-window-override
Feb 21, 2026
Merged

fix: override context window for MiniMax/Kimi free models#5568
kevinvandijk merged 3 commits intoKilo-Org:mainfrom
romeoscript:hotfix/context-window-override

Conversation

@romeoscript
Copy link
Copy Markdown

Enforces a 200k context window for and to prevent aggressive truncation caused by incorrect API limitations.

Context

fixes #5566

Implementation

I resolved the issue by patching the model information parsing logic to manually override the reported context window for the affected free-tier models.

Screenshots

before after

How to Test

Launch the Extension:
Open the project in VS Code.
Press F5 to start a debug session (or build and install the .vsix).
Select the Model:
Open the extension sidebar.
Go to Settings (gear icon) -> Provider.
Select KiloCode (or OpenRouter).
In the Model dropdown, select either Mini-Max 2.1:free or Kimi 2.5:free.
Verify Context Limits:
Start a chat session.
Look at the Context Window Indicator (the progress bar at the bottom of the chat interface).
Before Fix: The total capacity (right-side number) would show approximately 32k (or roughly 32,768).
After Fix: The total capacity should now display ~200k (specifically 200,000).
Functional Test:
Paste a large amount of text (e.g., >40k tokens) into the chat.
Verify that the "Context Truncated" warning does not appear and the extension sends the full context to the model.

Get in Touch

Enforces a 200k context window for  and  to prevent aggressive truncation caused by incorrect API limitations.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 31, 2026

🦋 Changeset detected

Latest commit: 97f8325

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jeremylongshore added a commit to jeremylongshore/kilocode that referenced this pull request Feb 15, 2026
Mirror: fix: override context window for MiniMax/Kimi free models (Kilo-Org#5568)
}

// kilocode_change start
if (id.includes("minimax-2.1:free") || id.includes("kimi-2.5:free")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Missing test coverage for this new override.

Every other model-specific override in parseOpenRouterModel has a corresponding test in openrouter.spec.ts (e.g., horizon-alpha, horizon-beta, claude-sonnet-4.6). This new context window override for MiniMax/Kimi free models should also have test coverage.

Consider adding tests like:

it("overrides context window for minimax-2.1:free models", () => {
  const mockModel = {
    name: "MiniMax 2.1 Free",
    description: "Test model",
    context_length: 1000000,
    max_completion_tokens: 8192,
    pricing: { prompt: "0", completion: "0" },
  }

  const result = parseOpenRouterModel({
    id: "minimax/minimax-2.1:free",
    model: mockModel,
    inputModality: ["text"],
    outputModality: ["text"],
    maxTokens: 8192,
  })

  expect(result.contextWindow).toBe(200000)
})

And a similar test for kimi-2.5:free.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Feb 21, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/api/providers/fetchers/openrouter.ts 324 Missing test coverage for new MiniMax/Kimi context window override. Every other override in parseOpenRouterModel has tests in openrouter.spec.ts.
Files Reviewed (2 files)
  • .changeset/ten-knives-share.md - 0 issues
  • src/api/providers/fetchers/openrouter.ts - 1 issue

Fix these issues in Kilo Cloud

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.

[CRITICAL] Aggressive context condensation on free models (~130-150k → 21kB) via KiloCode API - total session loss

2 participants