fix(cli): switch to the code model after planning - #13112
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02e83206a4
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of Files Reviewed (2 files)
Previous Review Summaries (5 snapshots, latest commit 645b306)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 645b306)Status: 1 Issue Found | Recommendation: Address before merge Incremental review of Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Previous review (commit baf3281)Status: No Issues Found | Recommendation: Merge Incremental review of
New code verified: Files Reviewed (3 files)
Previous review (commit 3284c1f)Status: 3 Issues Found | Recommendation: Address before merge Overview
Incremental review of Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (6 files)
Fix these issues in Kilo Cloud Previous review (commit ff79f15)Status: 3 Issues Found | Recommendation: Address before merge Overview
Incremental review of Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (5 files)
Fix these issues in Kilo Cloud Previous review (commit 446c42e)Status: 3 Issues Found | Recommendation: Address before merge Overview
Incremental review of Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (5 files)
Reviewed by kimi-k3 · Input: 125.2K · Output: 5.3K · Cached: 317.8K Review guidance: REVIEW.md from base branch |
ff79f15 to
a3516c1
Compare
Keep the saved or configured code model when leaving a planning session, even if the catalog lookup fails, so implementation starts on the code model instead of the planning one. Fall back through recent models when no code pick exists, skip handover when its model cannot be resolved, and stamp setAgentModel only on Continue here.
3284c1f to
baf3281
Compare
Preserve the planning model when no saved or configured code pick exists. Look up the handover model once from the compaction agent or the planning model.
If the compaction agent's configured model is missing from the catalog, look up the planning model before skipping handover.
Issue
Fixes #13109
Context
Leaving a planning session via Start new session or Continue here was still billing the planning model. The first implementation turn now uses the saved or configured code model.
resolveCodeModeltreated a failed standalone catalog lookup as “no code model” and fell through to the planning model. Interrupt + “go on” then used the TUI picker, which is why the correct model appeared only after stopping.Implementation
Catalog lookups now go through the shared
AppRuntimeinstead of a standalone provider runtime whose first failure was cached forever.KilocodeModelStatereadsmodel.jsonso a branded parse cannot drop the saved pick.stamp()distinguishes a genuineModelNotFoundError(fall through to the configured code model) from a transient catalog failure (keep the saved IDs; the session loop already validates). The resolved model is applied on new-session creation and viasetAgentModelon Continue here only.When no saved or configured code pick exists, the planning model is kept. Handover still tries the compaction model, then the planning model, and skips if neither resolves.
TUI question-picker agent switching was dropped: the existing prompt sync effect already flips agent/model when the injected code-mode message lands. VS Code still gets an optimistic agent flip from
option.mode.Screenshots / Video
Plan model selection
Code model selection (after plan exit "Start in a new session"
How to Test
Manual/local verification
cd packages/opencode && bun test ./test/kilocode/plan-followup.test.ts(34 pass).bun run typecheckinpackages/opencodeclean. CI on5e9b76fe36green.bun dev. Switch to code, pick model A. Switch to plan, pick model B, ask for a short plan. On Ready to implement?, choose Continue here — footer/model should be A, not B. Start new session should open already oncode+ A.Reviewer test steps
bun devfrom this worktree (not PATHkilo)./agent→ code, select a code model./agent→ plan, select a different planning model.code+ that model.Checklist
Get in Touch