Skip to content

fix: context limit display uses stale model after model switch #11902

Description

@Ivaloz

Description

After switching models mid-session, the context limit percentage in the sidebar continues to display based on the previous model's context window, not the currently selected model.

Example

  1. Start session with model A (128k context)
  2. Use model A for several messages, context shows 50% used (64k/128k)
  3. Switch to model B (32k context)
  4. Context still shows 50% used, but should show 200% (64k/32k) or at least use model B's limit

Root Cause

In the sidebar context component, the context limit is calculated using the model from the last assistant message, not the currently selected model.

Proposed Fix

Use the currently selected model for context limit display when available.

MiMo Code Reference

This fix has been implemented in MiMo Code PR #1522: XiaomiMiMo/MiMo-Code#1522

Environment

  • Kilo Code version: latest
  • OS: Windows 11
  • Terminal: PowerShell

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions