From 1755f567fc8cbf4e8b950a3f862ff4e72ab77d70 Mon Sep 17 00:00:00 2001 From: marius-kilocode Date: Fri, 3 Jul 2026 17:45:48 +0200 Subject: [PATCH] fix(agent-manager): apply reasoning-variant and mode picks in worktree dialog The reasoning-variant and mode pickers in the New Worktree dialog portaled their popover content to , where the dialog's full-screen modal overlay (z-index 50, pointer-events auto) intercepted pointer events before the option onClick fired. Selecting a variant dismissed the popover via the overlay without applying the choice, so the trigger label reverted to the previous value. The model picker already avoided this with portal={false} (09f0156bfc). Forward the same portal prop through ThinkingSelectorBase and ModeSwitcherBase and pass portal={false} from NewWorktreeDialog so all three pickers render inline within the dialog content, above the overlay. Reproduced live in the isolated VS Code self-test: before the fix a real pointer click on a variant option timed out with 'dialog-overlay ... intercepts pointer events' and the label stayed unchanged; after the fix the popover nests inside [dialog] and clicking a variant applies in both directions with no console errors. --- .changeset/fix-worktree-reasoning-selector.md | 5 +++++ .../webview-ui/agent-manager/NewWorktreeDialog.tsx | 9 ++++++++- .../webview-ui/src/components/shared/ModeSwitcher.tsx | 3 +++ .../src/components/shared/ThinkingSelector.tsx | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-worktree-reasoning-selector.md diff --git a/.changeset/fix-worktree-reasoning-selector.md b/.changeset/fix-worktree-reasoning-selector.md new file mode 100644 index 00000000000..a08dc6fa930 --- /dev/null +++ b/.changeset/fix-worktree-reasoning-selector.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Fix the reasoning-variant (and mode) picker in the New Worktree dialog so selecting a variant actually applies. The pickers portaled their popover to the page body, where the dialog's modal overlay intercepted pointer events and swallowed the click before the option handler ran. Render the popovers inline (`portal={false}`), matching the model picker already fixed for the same reason. diff --git a/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx b/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx index f3b39c2cdb9..d3f59a0d420 100644 --- a/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx +++ b/packages/kilo-vscode/webview-ui/agent-manager/NewWorktreeDialog.tsx @@ -474,7 +474,13 @@ export const NewWorktreeDialog: Component<{ onClose: () => void; defaultBaseBran
1}> - + void; defaultBaseBran variants={variants()} value={effectiveVariant()} onSelect={setVariant} + portal={false} deferDismiss /> diff --git a/packages/kilo-vscode/webview-ui/src/components/shared/ModeSwitcher.tsx b/packages/kilo-vscode/webview-ui/src/components/shared/ModeSwitcher.tsx index d078192110f..4ca0f754cca 100644 --- a/packages/kilo-vscode/webview-ui/src/components/shared/ModeSwitcher.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/shared/ModeSwitcher.tsx @@ -35,6 +35,8 @@ export interface ModeSwitcherBaseProps { value: string /** Called when the user picks an agent */ onSelect: (name: string) => void + /** Render inline instead of through a portal when nested in a dialog. */ + portal?: boolean /** Delay outside dismissal while the popover opens inside a dialog. */ deferDismiss?: boolean } @@ -124,6 +126,7 @@ export const ModeSwitcherBase: Component = (props) => { expanded={false} placement="top-start" minHeight={100} + portal={props.portal} deferDismiss={props.deferDismiss} open={open()} onOpenChange={onOpen} diff --git a/packages/kilo-vscode/webview-ui/src/components/shared/ThinkingSelector.tsx b/packages/kilo-vscode/webview-ui/src/components/shared/ThinkingSelector.tsx index 45f9b827ae8..652bb70bb08 100644 --- a/packages/kilo-vscode/webview-ui/src/components/shared/ThinkingSelector.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/shared/ThinkingSelector.tsx @@ -32,6 +32,8 @@ export interface ThinkingSelectorBaseProps { clearLabel?: string /** Popover placement — defaults to top-start. */ placement?: "top-start" | "bottom-start" | "bottom-end" | "top-end" + /** Render inline instead of through a portal when nested in a dialog. */ + portal?: boolean /** Delay outside dismissal while the popover opens inside a dialog. */ deferDismiss?: boolean /** Listen for the global prompt trigger event. Defaults to true. */ @@ -138,6 +140,7 @@ export const ThinkingSelectorBase: Component = (props placement={props.placement ?? "top-start"} preferredWidth={180} minHeight={100} + portal={props.portal} deferDismiss={props.deferDismiss} open={open()} onOpenChange={onOpen}