mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-29 03:44:06 +08:00
fix(agent-manager): keep detail pane for unassigned sessions (#12722)
The setup-terminal gate introduced in #12703 changed the detail-stack predicate from !contextEmpty() && !history() to !history && selection !== null. An unassigned session has selection === null but a live session showing, so contextEmpty() is false there. The new gate dropped that case, blanking the content pane, leaving readOnly() dead code, and unmounting every live xterm on selection. showTerminalStack now takes contextEmpty and returns !history && (selection !== null || !contextEmpty), restoring the pre-#12703 semantics while keeping the provisioning worktree (empty context with a side Setup tab) rendering the stack. Adds a showTerminalStack regression suite covering the unassigned, history, selected-context, provisioning, and empty cases.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"kilo-code": patch
|
||||
---
|
||||
|
||||
Fix the Agent Manager detail pane blanking when an unassigned session is selected. Clicking a session that belongs to no worktree now renders the chat and read-only banner again instead of an empty content area, and live terminal tabs stay mounted across the switch.
|
||||
@@ -1,9 +1,38 @@
|
||||
import { describe, expect, it } from "bun:test"
|
||||
import { createRoot, createSignal } from "solid-js"
|
||||
import { LOCAL } from "../../webview-ui/agent-manager/navigate"
|
||||
import { ambientDecision, createAmbientSetup } from "../../webview-ui/agent-manager/terminal/ambient"
|
||||
import { ambientDecision, createAmbientSetup, showTerminalStack } from "../../webview-ui/agent-manager/terminal/ambient"
|
||||
import { createTerminalState } from "../../webview-ui/agent-manager/terminal/state"
|
||||
|
||||
describe("showTerminalStack", () => {
|
||||
it("hides the detail stack while the history view is open", () => {
|
||||
expect(showTerminalStack(true, "wt-1", false)).toBe(false)
|
||||
expect(showTerminalStack(true, null, false)).toBe(false)
|
||||
})
|
||||
|
||||
it("shows the detail stack for a selected context with sessions", () => {
|
||||
expect(showTerminalStack(false, "wt-1", false)).toBe(true)
|
||||
expect(showTerminalStack(false, LOCAL, false)).toBe(true)
|
||||
})
|
||||
|
||||
it("keeps the detail stack for a provisioning worktree with no sessions", () => {
|
||||
// The side terminal hosts the live Setup tab next to the empty state,
|
||||
// so the stack must render even when the context is empty.
|
||||
expect(showTerminalStack(false, "wt-1", true)).toBe(true)
|
||||
})
|
||||
|
||||
it("shows the detail stack for an unassigned session", () => {
|
||||
// selection === null with a live session: contextEmpty is false, and
|
||||
// the stack hosts the read-only banner / chat. The old gate rendered
|
||||
// here; dropping this case blanks the pane and unmounts live xterms.
|
||||
expect(showTerminalStack(false, null, false)).toBe(true)
|
||||
})
|
||||
|
||||
it("hides the detail stack when nothing is selected and the context is empty", () => {
|
||||
expect(showTerminalStack(false, null, true)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("ambientDecision", () => {
|
||||
it("waits while setup is still running", () => {
|
||||
expect(ambientDecision(undefined, "wt-1", "wt-1")).toBe("wait")
|
||||
|
||||
@@ -671,7 +671,7 @@ const AgentManagerContent: Component = () => {
|
||||
return false
|
||||
})
|
||||
|
||||
const showDetailStack = createMemo(() => showTerminalStack(history(), selection()))
|
||||
const showDetailStack = createMemo(() => showTerminalStack(history(), selection(), contextEmpty()))
|
||||
|
||||
const overlay = createMemo((): SetupState | null => {
|
||||
const state = setup()
|
||||
|
||||
@@ -23,9 +23,12 @@ interface AmbientSetupDeps {
|
||||
|
||||
export type AmbientDecision = "wait" | "hide" | "keep"
|
||||
|
||||
/** Selected contexts own the detail stack; history/unassigned are exclusive. */
|
||||
export function showTerminalStack(history: boolean, selection: string | null): boolean {
|
||||
return !history && selection !== null
|
||||
/** The detail stack hosts chat, terminals, and the read-only banner.
|
||||
* It shows for any selected context (local/worktree) and for an
|
||||
* unassigned session, where `selection` is null but the context is not
|
||||
* empty (a live session is showing). The history view is exclusive. */
|
||||
export function showTerminalStack(history: boolean, selection: string | null, contextEmpty: boolean): boolean {
|
||||
return !history && (selection !== null || !contextEmpty)
|
||||
}
|
||||
|
||||
/** Setup output owns progress/error presentation when its terminal exists. */
|
||||
|
||||
Reference in New Issue
Block a user