fix(vscode): reliable cancel and preserved session model on attach#1845
Merged
Conversation
|
5 tasks
commit: |
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No issue — the problem is explained in the next section (reported by extension users in feedback).
Problem
Two reported correctness problems in the VS Code extension (split out of #1839 to land the bug fixes promptly; the conversation-undo feature stays in that PR):
SessionRuntime.cancel()returned early whenever the host-side bookkeeping showed no active work. After an abnormal error path, host and engine state can drift apart — the UI shows a running turn while the host thinks the session is idle, so Stop silently never reaches the engine. AdditionallyabortChatreturned{ aborted: true }even when no runtime existed, so the UI claimed the task was stopped while nothing was cancelled.What changed
session-runtime.ts): the early return only skips when the runtime is closed —session.cancel()is always invoked (a harmless no-op when the engine is idle), so Stop always converges the engine and the UI even if host bookkeeping drifted.abortChatreturnsaborted: falsewhen the view has no runtime instead of pretending.kimi-runtime.ts): the configured default model is only applied at session creation, matching the thinking-effort fix and CLI/TUI resume semantics.chat.handler.ts): since attach no longer syncs modes, thestreamChatpreflight applies the model/effort sent with the prompt (previously a picker change followed immediately by Send could race onto the old model).resume-vs-prompt semantics stay distinct: reopening preserves the session's modes, sending applies what the composer shows.Tests: idle-cancel still reaching the engine,
abortChathonesty at the bridge boundary, preserved-model on resume, and an end-to-end integration test that submits a different model/effort with a prompt and asserts the session adopts them.Checklist
gen-changesetsskill, or this PR needs no changeset. (No changeset: vscode-extension-only change, nothing enters the CLI bundle.)gen-docsskill, or this PR needs no doc update. (Extension behavior fix; no user-facing docs affected.)