Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(chat): the pinned plan folds by a click on its head, open by default, kept per chat (CA)

purple4bc27af5dce5
diff --git a/e2e/ca-shots.spec.ts b/e2e/ca-shots.spec.ts
index 2b6a50a0..9bef8e76 100644
--- a/e2e/ca-shots.spec.ts
+++ b/e2e/ca-shots.spec.ts
@@ -196,13 +196,18 @@ test.describe('CA shots: pinned plan', () => {
}
await openNewChat(page)
await send(page, 'median() in src/math.ts is missing, implement it and run the tests')
- await expect(page.getByTestId('plan-pinned')).toBeVisible({ timeout: 30_000 })
+ // Open by default (David, 14.11.2026): every step, the running one spins.
+ const plan = page.getByTestId('plan-pinned')
+ await expect(plan.getByTestId('plan-steps')).toBeVisible({ timeout: 30_000 })
await shot(page, `plan-${theme}-${width}-1-running`)
+ // Folded by a click on the head: "Plan" and the running step.
+ await plan.getByTitle('Collapse the plan').click()
+ await expect(plan.getByTestId('plan-folded-step')).toBeVisible()
+ await shot(page, `plan-${theme}-${width}-1b-running-folded`)
+ await plan.getByTitle('Show every step').click()
await page.evaluate(() => (window as unknown as { __E2E_RELEASE_TOOLS__?: () => void }).__E2E_RELEASE_TOOLS__?.())
await expect(page.getByTestId('plan-run-stopped')).toBeVisible({ timeout: 60_000 })
await shot(page, `plan-${theme}-${width}-2-ended`)
- // Folded to one line: the count and the step that comes next.
- const plan = page.getByTestId('plan-pinned')
await plan.getByTitle('Collapse the plan').click()
await shot(page, `plan-${theme}-${width}-3-folded`)
await plan.getByTitle('Show every step').click()
@@ -225,11 +230,16 @@ test.describe('CA shots: pinned plan', () => {
await send(page, 'median() in src/math.ts is missing, implement it and run the tests')
// David, 14.11.2026: finished is the list with every tick, no count,
// no closing line.
+ // Open (the default): every step ticked. Folded: "Plan" and a tick.
const plan = page.getByTestId('plan-pinned')
await expect(plan.locator('li[data-state="done"]')).toHaveCount(3, { timeout: 60_000 })
await expect(plan.locator('.animate-spin')).toHaveCount(0, { timeout: 60_000 })
await expect(plan).not.toContainText(/every step done|\d+ of \d+/i)
await shot(page, `plan-${theme}-1280-5-all-done`)
+ await plan.getByTitle('Collapse the plan').click()
+ await expect(plan.getByTestId('plan-folded-done')).toBeVisible()
+ await shot(page, `plan-${theme}-1280-5b-all-done-folded`)
+ await plan.getByTitle('Show every step').click()
// The next message: the pinned plan leaves, a folded "Plan" row stays at
// the answer it belonged to.
await send(page, 'thanks, mention it in the README too')
@@ -270,7 +280,7 @@ test.describe('CA shots: pinned plan', () => {
if (await sandbox.isVisible({ timeout: 5_000 }).catch(() => false)) await sandbox.click()
await expect(agent).toHaveAttribute('title', /Agent Mode is on/i, { timeout: 10_000 })
await send(page, 'median() in src/math.ts is missing, implement it and run the tests')
- await expect(page.getByTestId('plan-pinned')).toBeVisible({ timeout: 30_000 })
+ await expect(page.getByTestId('plan-pinned').getByTestId('plan-steps')).toBeVisible({ timeout: 30_000 })
await shot(page, `plan-agent-${theme}-1280-1-running`)
await page.evaluate(() => (window as unknown as { __E2E_RELEASE_TOOLS__?: () => void }).__E2E_RELEASE_TOOLS__?.())
await expect(page.getByTestId('plan-run-stopped')).toBeVisible({ timeout: 60_000 })
diff --git a/e2e/coding-agent.spec.ts b/e2e/coding-agent.spec.ts
index b2f10bde..0fd162fc 100644
--- a/e2e/coding-agent.spec.ts
+++ b/e2e/coding-agent.spec.ts
@@ -283,16 +283,16 @@ test('the plan the model writes shows up above the composer and tracks progress'
await expect(page.getByRole('main').getByText('PLAN_RUN_DONE')).toBeVisible({ timeout: 30_000 })
// The plan is pinned under the newest message (CA, 13.11.2026), open by
- // default like the Claude Code desktop app. The toggle names the state it
- // is in, so nothing here is assumed.
+ // default (David, 14.11.2026). The toggle names the state it is in, so
+ // nothing here is assumed.
const strip = page.getByTestId('plan-pinned')
- // No count (David, 14.11.2026): the head is "Plan", the rows carry the state.
+ // No count: the head is "Plan", the rows carry the state.
await expect(strip.getByTestId('plan-title')).toHaveText('Plan', { timeout: 15_000 })
await expect(strip.locator('li[data-state="done"]')).toHaveCount(1)
await expect(strip.getByText('read the config')).toBeVisible()
await expect(strip.getByText('run the suite')).toBeVisible()
- // Folded: the name and the step that is running right now, not the list.
+ // Folded by a click on the head: the name and the step that runs now.
await strip.getByTitle('Collapse the plan').click()
await expect(strip.getByTitle('Show every step')).toContainText('patch the parser')
await expect(strip.getByText('read the config')).toHaveCount(0)
diff --git a/src/components/chat/PlanBar.tsx b/src/components/chat/PlanBar.tsx
index 0ba56c73..ebb83646 100644
--- a/src/components/chat/PlanBar.tsx
+++ b/src/components/chat/PlanBar.tsx
@@ -173,7 +173,13 @@ export function PlanBar({ conversationId, onContinue }: Props) {
const msgs = s.conversations.find((c) => c.id === conversationId)?.messages
return msgs ? retiredAt(msgs, updatedAt) !== null : false
})
- const [collapsed, setCollapsed] = useState(false)
+ // Open unless the user folded it, per chat, in the store (David,
+ // 14.11.2026: open by default, a click on the head folds it, and the choice
+ // stays with the chat). A running step never folds or unfolds it again, and
+ // a redraw of the transcript cannot reset it.
+ const open = useTodoStore((s) => (conversationId ? s.planOpen?.[conversationId] !== false : true))
+ const setPlanOpen = useTodoStore((s) => s.setPlanOpen)
+ const collapsed = !open
if (!conversationId || !todos || todos.length === 0) return null
// Gone the moment the user writes, also while the new run starts; a run that
@@ -202,7 +208,7 @@ export function PlanBar({ conversationId, onContinue }: Props) {
<div className="flex items-center gap-2">
<button
type="button"
- onClick={() => setCollapsed((v) => !v)}
+ onClick={() => setPlanOpen(conversationId, collapsed)}
aria-expanded={!collapsed}
title={collapsed ? 'Show every step' : 'Collapse the plan'}
className="group flex items-center gap-2 min-w-0 flex-1 text-left"
@@ -212,8 +218,19 @@ export function PlanBar({ conversationId, onContinue }: Props) {
<span className={TONE.quiet} data-testid="plan-title">
{PLAN_TITLE}
</span>
- {collapsed && (
- <span className={runningIdx >= 0 ? TONE.strong : TONE.normal} title={headline.content}>
+ {/* Folded: the step that runs, with its spinner; through: a tick;
+ ended early: the next open step. No count. */}
+ {collapsed && runningIdx >= 0 && (
+ <span className={TONE.strong} title={headline.content} data-testid="plan-folded-step">
+ <Loader2 size={ICON_SM} className={`inline ${TONE.strong} animate-spin mx-1.5 -mt-0.5`} />
+ {headline.content}
+ </span>
+ )}
+ {collapsed && runningIdx < 0 && allDone && (
+ <Check size={ICON_SM} className={`inline ${GLYPH_QUIET} ml-1.5 -mt-0.5`} data-testid="plan-folded-done" />
+ )}
+ {collapsed && runningIdx < 0 && !allDone && (
+ <span className={TONE.normal} title={headline.content} data-testid="plan-folded-step">
{' '}· {headline.content}
</span>
)}
diff --git a/src/components/chat/__tests__/plan-leaves-with-the-next-message.test.tsx b/src/components/chat/__tests__/plan-leaves-with-the-next-message.test.tsx
index 3378f13a..72e2a72b 100644
--- a/src/components/chat/__tests__/plan-leaves-with-the-next-message.test.tsx
+++ b/src/components/chat/__tests__/plan-leaves-with-the-next-message.test.tsx
@@ -29,7 +29,7 @@ function seedChat(messages: Message[]) {
}
beforeEach(() => {
- useTodoStore.setState({ byConversation: {}, updatedAt: {}, archived: {} })
+ useTodoStore.setState({ byConversation: {}, updatedAt: {}, archived: {}, planOpen: {} })
useGenerationStore.setState((s) => ({ generating: { ...s.generating, [CONV]: false } }))
})
afterEach(() => cleanup())
diff --git a/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx b/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx
index 13076bf1..39ff22bb 100644
--- a/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx
+++ b/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx
@@ -26,7 +26,8 @@ function running(on: boolean) {
}
beforeEach(() => {
- useTodoStore.setState({ byConversation: {}, updatedAt: {} })
+ // No choice made yet: open, the default (David, 14.11.2026).
+ useTodoStore.setState({ byConversation: {}, updatedAt: {}, planOpen: {} })
useStagedChangesStore.setState({ byChat: {} } as never)
running(false)
})
@@ -184,3 +185,60 @@ describe('PlanBar, pinned in the transcript', () => {
expect(v.getByTestId('plan-run-stopped')).toBeTruthy()
})
})
+
+describe('open by default, folded by a click, kept per chat (David, 14.11.2026)', () => {
+ beforeEach(() => { useTodoStore.setState({ planOpen: {} }) })
+
+ it('starts open, with every step and no count', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ expect(v.getByTestId('plan-steps')).toBeTruthy()
+ expect(v.getByTitle('Collapse the plan')).toBeTruthy()
+ expect(v.getByTestId('plan-pinned').textContent).not.toMatch(/\d+\s*(of|\/)\s*\d+/)
+ })
+
+ it('folded while running: "Plan" and the running step with its spinner', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ fireEvent.click(v.getByTitle('Collapse the plan'))
+ expect(v.queryByTestId('plan-steps')).toBeNull()
+ const step = v.getByTestId('plan-folded-step')
+ expect(step.textContent).toBe('Write median()')
+ expect(step.querySelector('.animate-spin')).toBeTruthy()
+ })
+
+ it('folded and through: "Plan" with a tick, nothing else', () => {
+ useTodoStore.getState().setPlanOpen(CONV, false)
+ writeTodos(CONV, PLAN.map((t) => ({ ...t, status: 'completed' as const })))
+ const v = render(<PlanBar conversationId={CONV} />)
+ expect(v.getByTestId('plan-folded-done')).toBeTruthy()
+ expect(v.queryByTestId('plan-folded-step')).toBeNull()
+ expect(v.container.querySelectorAll('.animate-spin')).toHaveLength(0)
+ })
+
+ it('the choice stays while the run goes on and through a redraw', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ fireEvent.click(v.getByTitle('Collapse the plan'))
+ expect(useTodoStore.getState().planOpen[CONV]).toBe(false)
+ act(() => { writeTodos(CONV, [{ content: 'Read the file', status: 'completed' }, { content: 'Write median()', status: 'completed' }, { content: 'Run the tests', status: 'in_progress' }]) })
+ expect(v.queryByTestId('plan-steps')).toBeNull()
+ v.unmount()
+ const again = render(<PlanBar conversationId={CONV} />)
+ expect(again.queryByTestId('plan-steps')).toBeNull()
+ fireEvent.click(again.getByTitle('Show every step'))
+ expect(again.getByTestId('plan-steps')).toBeTruthy()
+ expect(useTodoStore.getState().planOpen[CONV]).toBe(true)
+ })
+
+ it('another chat keeps its own state', () => {
+ useTodoStore.getState().setPlanOpen('other-chat', false)
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ expect(v.getByTestId('plan-steps')).toBeTruthy()
+ })
+})
diff --git a/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts b/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
index 66855a1a..d303f2ef 100644
--- a/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
+++ b/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
@@ -87,9 +87,12 @@ describe('die Leiste fragt beide Laufquellen, nicht nur eine', () => {
expect(src).toMatch(/t\.status === 'in_progress' && runActive && !running/)
expect(src).toMatch(/state === 'running' \? \(\s*<Loader2[^>]*animate-spin/)
expect(src).toMatch(/halted \? HINWEIS_TEXT\.ruhig/)
- // Und es gibt genau EINE Drehung in der Datei, sonst koennte daneben ein
- // zweiter Kreisel stehen, den kein Lauf mehr anhaelt.
- expect(src.match(/animate-spin/g) ?? []).toHaveLength(1)
+ // Zwei Drehungen in der Datei, beide an einem laufenden Schritt: die Zeile
+ // in der Liste und, seit 14.11.2026, die eingeklappte Kopfzeile. Die
+ // zweite steht nur, solange ein Schritt 'running' ist (runningIdx >= 0),
+ // und das gibt es nur bei laufendem Lauf.
+ expect(src.match(/animate-spin/g) ?? []).toHaveLength(2)
+ expect(src).toMatch(/\{collapsed && runningIdx >= 0 && \(/)
})
it('die Schlusszeile hat einen Ton, den ruhigen', () => {
diff --git a/src/stores/todoStore.ts b/src/stores/todoStore.ts
index 3f2e5145..a8f54d73 100644
--- a/src/stores/todoStore.ts
+++ b/src/stores/todoStore.ts
@@ -46,6 +46,11 @@ interface TodoState {
* (lib/plan-pin.ts). The pinned plan leaves the chat once the user writes
* again; the transcript keeps it as a folded "Plan" row. */
archived: Record<string, ArchivedPlan[]>
+ /** conversation id -> the pinned plan is unfolded. Open unless the user
+ * folded it (David, 14.11.2026); kept per chat, so a running step never
+ * folds or unfolds it again. */
+ planOpen: Record<string, boolean>
+ setPlanOpen: (conversationId: string, open: boolean) => void
setTodos: (conversationId: string, todos: TodoItem[]) => void
archivePlan: (conversationId: string, anchorId: string, todos: TodoItem[]) => void
@@ -82,6 +87,10 @@ export const useTodoStore = create<TodoState>()(
byConversation: {},
updatedAt: {},
archived: {},
+ planOpen: {},
+
+ setPlanOpen: (conversationId, open) =>
+ set((s) => ({ planOpen: { ...s.planOpen, [conversationId]: open } })),
setTodos: (conversationId, todos) =>
set((s) => ({
@@ -101,10 +110,12 @@ export const useTodoStore = create<TodoState>()(
const byConversation = { ...s.byConversation }
const updatedAt = { ...s.updatedAt }
const archived = { ...s.archived }
+ const planOpen = { ...s.planOpen }
delete byConversation[conversationId]
delete updatedAt[conversationId]
delete archived[conversationId]
- return { byConversation, updatedAt, archived }
+ delete planOpen[conversationId]
+ return { byConversation, updatedAt, archived, planOpen }
}),
getTodos: (conversationId) =>