Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/restore-promoted-worktree-title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Restore the session title and branch subtitle immediately when opening an existing session in a worktree.
37 changes: 37 additions & 0 deletions packages/kilo-vscode/tests/unit/project-sessions-live.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { describe, expect, it } from "bun:test"
import { createRoot, createSignal } from "solid-js"
import { createProjectSessionsLive } from "../../webview-ui/agent-manager/project/sessions-live"
import type { ProjectSessionInfo, SessionInfo } from "../../webview-ui/src/types/messages"

const session = (worktreeId: string | null): ProjectSessionInfo => ({
id: "session-1",
parentID: null,
title: "Restore worktree metadata",
createdAt: "2026-08-26T10:00:00.000Z",
updatedAt: "2026-08-26T10:00:00.000Z",
worktreeId,
})

describe("project session live state", () => {
it("uses managed placement while the project session cache is stale", () => {
createRoot((dispose) => {
const [base] = createSignal<Record<string, ProjectSessionInfo[]>>({ project: [session(null)] })
const [store] = createSignal<SessionInfo[]>([session(null)])
const live = createProjectSessionsLive({
base,
pid: () => "project",
enabled: () => true,
store,
managed: () => [{ id: "session-1", worktreeId: "worktree-1", createdAt: "2026-08-26T10:00:00.000Z" }],
locals: () => new Set(),
})

expect(live().project?.[0]).toMatchObject({
id: "session-1",
title: "Restore worktree metadata",
worktreeId: "worktree-1",
})
dispose()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export function createProjectSessionsLive(opts: {
const live = new Map(store.filter(isKnownRootSession).map((item) => [item.id, item]))
const merged = pushed.map((item) => {
const fresh = live.get(item.id)
return fresh ? { ...fresh, worktreeId: item.worktreeId } : item
const worktreeId = managed.has(item.id) ? managed.get(item.id)! : item.worktreeId
return fresh ? { ...fresh, worktreeId } : worktreeId === item.worktreeId ? item : { ...item, worktreeId }
})
const known = new Set(pushed.map((item) => item.id))
const owned = (id: string) => managed.has(id) || opts.locals().has(id)
Expand Down
Loading