Skip to content

feat: warn about context-cache loss when switching model or thinking effort - #1763

Merged
liruifengv merged 6 commits into
mainfrom
feat/model-effort-cache-warning
Jul 16, 2026
Merged

feat: warn about context-cache loss when switching model or thinking effort#1763
liruifengv merged 6 commits into
mainfrom
feat/model-effort-cache-warning

Conversation

@liruifengv

@liruifengv liruifengv commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — see the problem described below.

Problem

Once a conversation has started, switching the model or thinking effort resends the accumulated context, invalidating the provider's prompt cache and increasing token usage. The /model and /effort pickers gave no indication of this cost, so users would switch mid-conversation without realizing it gets more expensive.

What changed

  • The /model and /effort pickers now render warning-colored lines directly below the key-hint line once the conversation has at least one user message: "Note: Switching models invalidates the existing prompt cache. Use /new to avoid extra token costs." (effort variant: "Note: Switching effort invalidates the existing prompt cache. Use /new to avoid extra token costs."). When the text exceeds the terminal width it wraps onto multiple lines instead of being truncated.
  • The condition is computed in the command layer from user transcript entries (shell-command echoes excluded) and passed to the dialogs via a new optional warning option, keeping components purely presentational.
  • The tabbed model selector no longer assumes a fixed header height when inserting the tab strip, so the (possibly multi-line) warning shifts the strip and list correctly in both layouts.
  • Added component tests covering the warning line position, word wrapping on narrow widths, the no-warning layout, and the tab strip framing with a warning present.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill: no doc update needed — this is an informational line in an existing dialog, no commands or configuration changed.

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 71096db

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

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-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

@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@71096db
npx https://pkg.pr.new/@moonshot-ai/kimi-code@71096db

commit: 71096db

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43792a9c43

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/commands/config.ts
@liruifengv
liruifengv merged commit 81414b6 into main Jul 16, 2026
14 checks passed
@liruifengv
liruifengv deleted the feat/model-effort-cache-warning branch July 16, 2026 07:43
This was referenced Jul 16, 2026
ywh114 pushed a commit to ywh114/kimi-code that referenced this pull request Jul 19, 2026
…effort (MoonshotAI#1763)

* feat: warn about context-cache loss when switching model or thinking effort

* chore: polish the switch warning copy

* feat: wrap the switch warning instead of truncating it

* chore: bold /new in the switch warning

* Revert "chore: bold /new in the switch warning"

This reverts commit a438e87.

* chore: align the changeset with the warning copy
ywh114 pushed a commit to ywh114/kimi-code that referenced this pull request Jul 27, 2026
…effort (MoonshotAI#1763)

* feat: warn about context-cache loss when switching model or thinking effort

* chore: polish the switch warning copy

* feat: wrap the switch warning instead of truncating it

* chore: bold /new in the switch warning

* Revert "chore: bold /new in the switch warning"

This reverts commit a438e87.

* chore: align the changeset with the warning copy
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.

1 participant