fix(cli): preserve forked session variants#12175
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Previous Review Summaries (2 snapshots, latest commit 0062801)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0062801)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 0a388de)Status: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (5 files)
Reviewed by gpt-5.6-sol · Input: 58.5K · Output: 3.2K · Cached: 178.4K Review guidance: REVIEW.md from base branch |
johnnyeric
approved these changes
Jul 13, 2026
…eritance' into investigate-worktree-variant-inheritance
AlexOcculate
pushed a commit
to AlexOcculate/kilocode
that referenced
this pull request
Jul 14, 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.
Problem
Forked sessions copied their transcript but did not preserve the selected model configuration at the fork point. Agent Manager then records a synthetic
noReplyhandoff without a model or variant. That handoff resolved the model but omitted its reasoning variant, so it produced a user message with no variant and asynchronously switched the forked session to the default variant before the next user prompt.This affects Agent Manager session forks, including Fork session into a selected worktree or the local workspace. It also affects the sidebar's Continue in Worktree action, which creates a worktree and invokes the same fork-plus-handoff path. Ordinary sidebar follow-up prompts do not fork a session or record this handoff, so they are unaffected.
Behavior
For a full-session fork, retain the source session model and selected reasoning variant. For a historical fork at a message point, derive the model and variant from the latest retained user message instead of leaking a later source-session selection into the fork.
When a prompt has no explicit model and no agent-selected model, reuse the variant stored on that forked session when recording the synthetic handoff. Explicit prompt variants remain authoritative, and agent-selected models continue to use their existing model and variant behavior.
This keeps the selected reasoning level stable through the fork and its context handoff, while allowing later explicit model or variant selections to replace it.