fix(sidebar): poll project actions only while one is running

The sidebar indicator kept the terminal listing loop going for as long as
the sidebar was visible, in every client, whether or not anything was
running. It now lists once on mount, to pick up runs another client
started, and keeps the loop only while a project action is known to be
running anywhere; an idle sidebar costs no polling.

Claude-Session: https://claude.ai/code/session_01VqV56Hez25hTxXH4ipJfzH
This commit is contained in:
Bohdan Triapitsyn
2026-09-05 15:08:15 +03:00
parent f4eaa70eaa
commit 1e0d7abb6e
4 changed files with 41 additions and 12 deletions
@@ -278,6 +278,12 @@ const nextDefaultTabLabel = (tabs: readonly TerminalTab[]): string => {
return highest === 0 ? 'Terminal' : `Terminal ${highest + 1}`;
};
/** A project action the user would expect to see marked as running. */
export const isActiveProjectActionTab = (tab: TerminalTab): boolean =>
tab.purpose.type === 'project-action'
&& tab.purpose.executionId !== null
&& ACTIVE_PROJECT_ACTION_LIFECYCLES.has(tab.lifecycle);
const isLiveRunningTerminal = (tab: TerminalTab | undefined): boolean =>
Boolean(tab && tab.terminalSessionId !== null && tab.lifecycle === 'running');