From 5300ce51f3e0fcaebc1068dc57f467a86083b006 Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Thu, 20 Aug 2026 10:35:54 +0200 Subject: [PATCH] fix(agent-manager): preserve new worktree base branch --- .changeset/fix-worktree-base-branch.md | 5 +++++ .../tests/unit/new-worktree-dialog-sandbox.test.ts | 8 ++++++++ .../webview-ui/agent-manager/NewWorktreeDialog.tsx | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-worktree-base-branch.md diff --git a/.changeset/fix-worktree-base-branch.md b/.changeset/fix-worktree-base-branch.md new file mode 100644 index 00000000000..a3fcf8610e6 --- /dev/null +++ b/.changeset/fix-worktree-base-branch.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Use the displayed current branch as the base when creating a worktree from the New Worktree dialog. diff --git a/packages/kilo-vscode/tests/unit/new-worktree-dialog-sandbox.test.ts b/packages/kilo-vscode/tests/unit/new-worktree-dialog-sandbox.test.ts index 4b9c07a0489..1bb96d3f751 100644 --- a/packages/kilo-vscode/tests/unit/new-worktree-dialog-sandbox.test.ts +++ b/packages/kilo-vscode/tests/unit/new-worktree-dialog-sandbox.test.ts @@ -27,3 +27,11 @@ describe("NewWorktreeDialog sandbox toggle", () => { expect(src).not.toContain("visible as isSandboxVisible") }) }) + +describe("NewWorktreeDialog base branch", () => { + it("sends the displayed default base branch when advanced options stay closed", () => { + expect(src).toContain("const effectiveBaseBranch = () => baseBranch() ?? defaultBranch()") + expect(src).toContain("baseBranch: effectiveBaseBranch(),") + expect(src).not.toContain("baseBranch: advanced ? (baseBranch() ?? undefined) : undefined") + }) +}) diff --git a/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx b/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx index 559c1311bcb..69c9a2d8a72 100644 --- a/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx +++ b/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx @@ -475,7 +475,7 @@ export const NewWorktreeDialog: Component<{ modelID: sel?.modelID, agent: selectedAgent, variant: isCompare ? undefined : effectiveVariant(), - baseBranch: advanced ? (baseBranch() ?? undefined) : undefined, + baseBranch: effectiveBaseBranch(), branchName: customBranch, modelAllocations: allocations, sandbox: sandboxVisible() ? sandboxOverride() : undefined,