Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): stop the todo shimmer once the session is idle
vastsa9ad666512565
diff --git a/apps/desktop/src/components/TaskDock.tsx b/apps/desktop/src/components/TaskDock.tsxindex 6bdb9c5b9..06b2b3b43 100644--- a/apps/desktop/src/components/TaskDock.tsx+++ b/apps/desktop/src/components/TaskDock.tsx@@ -38,6 +38,10 @@ export function TaskDock({ sessionId }: { sessionId: string }) {function TaskDockPanel({ sessionId }: { sessionId: string }) {const { t } = useTranslation();const snapshot = useAppStore((state) => state.sessionTodos[sessionId]);+ // The shimmer is an infinite animation. A run that ends early can leave an+ // in_progress step behind, so the sweep follows the session's run state, not+ // the step's status alone: an idle window must stop submitting frames (#1064).+ const sessionRunning = useAppStore((state) => state.runningSessions[sessionId] ?? false);const panelId = useId();// The container now owns the todo read, so it recovers the snapshot the same@@ -117,7 +121,7 @@ function TaskDockPanel({ sessionId }: { sessionId: string }) {<span className="dock-header-text">{headerText}</span>{progress?.current ? (<span- className={`dock-header-current${collapsed ? " todo-dock-shimmer" : ""}`}+ className={`dock-header-current${collapsed && sessionRunning ? " todo-dock-shimmer" : ""}`}title={progress.current.content}>{progress.current.content}@@ -200,6 +204,7 @@ function TaskDockPanel({ sessionId }: { sessionId: string }) {todos={todos}listId={`${panelId}-todo`}interactive={!collapsed && tab === "todo"}+ animate={sessionRunning}/>) : null}{hasTasks && tab === "tasks" ? (diff --git a/apps/desktop/src/components/TodoDock.tsx b/apps/desktop/src/components/TodoDock.tsxindex b5434eea3..d84786d4a 100644--- a/apps/desktop/src/components/TodoDock.tsx+++ b/apps/desktop/src/components/TodoDock.tsx@@ -67,12 +67,15 @@ export function TodoPanel({todos,listId,interactive,+ animate,labelledBy,}: {todos: readonly SessionTodo[];listId: string;/** False while the container is collapsed: the list is mounted but inert. */interactive: boolean;+ /** False while the session is idle: a leftover in_progress step stays still. */+ animate: boolean;labelledBy?: string;}) {return (@@ -87,7 +90,7 @@ export function TodoPanel({a keyboard user can reach that scrollport only while it is on screen. */}<div className="todo-dock-list" role="list" tabIndex={interactive ? 0 : -1}>{todos.map((todo, index) => (- <TodoRow key={`${index}:${todo.content}`} todo={todo} shimmer={interactive} />+ <TodoRow key={`${index}:${todo.content}`} todo={todo} shimmer={interactive && animate} />))}</div></div>diff --git a/apps/desktop/test/background-tasks-dock-render.test.mjs b/apps/desktop/test/background-tasks-dock-render.test.mjsindex 780e0da89..78bbb54de 100644--- a/apps/desktop/test/background-tasks-dock-render.test.mjs+++ b/apps/desktop/test/background-tasks-dock-render.test.mjs@@ -68,6 +68,7 @@ async function withDockRender(run) {: undefined;Object.assign(useAppStore.getInitialState(), {sessionTodos: snapshot ? { [sessionId]: snapshot } : {},+ runningSessions: fixture.sessionRunning ? { [sessionId]: true } : {},});Object.assign(useModesStore.getInitialState(), {runs: fixture.run ? { [sessionId]: { sessionId, ...fixture.run } } : {},@@ -193,3 +194,28 @@ for (const activeTab of ["todo", "tasks"]) {});});}++test("the working step sweeps only while its session runs, so an idle window stops repainting", async () => {+ await withDockRender(({ render }) => {+ // A run that ends early (abort, error, a model that never closes its step)+ // leaves an in_progress todo behind. The shimmer is an infinite animation,+ // so tying it to the todo status alone would keep an idle window+ // submitting frames forever (#1064).+ const todos = [+ { content: "done step", status: "completed", priority: "low" },+ { content: "working step", status: "in_progress", priority: "high" },+ ];+ const shimmers = (html) => (html.match(/todo-dock-shimmer/g) ?? []).length;+ for (const collapsed of [true, false]) {+ const base = { tasks: [], sessionTasks: [], todos, collapsed, activeTab: "todo" };+ const idle = render({ ...base, sessionRunning: false });+ assert.match(idle, /working step/, "the step stays visible while idle");+ assert.equal(shimmers(idle), 0, `no sweep on an idle session (collapsed=${collapsed})`);+ assert.equal(+ shimmers(render({ ...base, sessionRunning: true })),+ 1,+ `one sweep while the session runs (collapsed=${collapsed})`,+ );+ }+ });+});