Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(kanban): show a held launch on the board and start it with ▶ (#1183)
Mina Samehe2f4ba5677f4
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 34d5f3937..a128d17bc 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -495,6 +495,7 @@ import { sameSshEndpoint, setKanbanPublishHook, setStoredCanvasPublishHook, usePimport { useAgentStatus, recordsTurnInterrupt } from '../state/agentStatus'import { hostChatSend, hostChatSession, hostChatStatus } from '../lib/hostChatQuery'import { chatPaneRefusal } from '../lib/chatPaneGate'+import { runQueuedNotice } from '../lib/boardRunQueued'import { useLaunchDelivery } from '../state/launchDelivery'import { useBrowserLease, drivingNodeIds } from '../state/browserLease'import { useTerminalFocus } from '../state/terminalFocus'@@ -10509,6 +10510,34 @@ export function Canvas() {(nodeId: string, icon: NodeIcon | undefined) => nodeWritesFor(activeProjectId).setIcon(nodeId, icon),[nodeWritesFor, activeProjectId])+ // ▶ on a board card's QUEUED chip: the `run` verb's path (runQueuedNodeRef) — the mounted node's+ // writer when the card's project is on the canvas, a headless start for a background Omni lane.+ // A relay tab's launch belongs to the host (the canvas node's ▶ is disabled there too).+ const runQueuedFromBoard = useCallback(+ async (projectId: string, nodeId: string) => {+ const project = useProjects.getState().getProject(projectId)+ if (!project) return+ const title =+ (project.nodes.find((n) => n.id === nodeId)?.title ??+ (nodesRef.current.find((n) => n.id === nodeId)?.data.title as string | undefined)) ||+ nodeId+ if (project.remote) {+ setNotice({ kind: 'info', text: `"${title}" runs on the host — open the host to start it.` })+ return+ }+ const notice = runQueuedNotice(await runQueuedNodeRef.current(project, nodeId), title)+ if (notice) setNotice(notice)+ },+ []+ )+ const runActiveQueuedFromBoard = useCallback(+ (nodeId: string) => void runQueuedFromBoard(activeProjectId, nodeId),+ [runQueuedFromBoard, activeProjectId]+ )+ const runQueuedFromOmni = useCallback(+ (projectId: string, nodeId: string) => void runQueuedFromBoard(projectId, nodeId),+ [runQueuedFromBoard]+ )// Stable identity for the memoized per-project board, which only ever shows the active project.const activeBoardNodeActionItems = useCallback((nodeId: string): MenuItem[] => boardNodeActionItems(nodeId, activeProjectId),@@ -18674,6 +18703,7 @@ export function Canvas() {nodeActionItems={boardNodeActionItems}onAiName={aiNameFromKanban}onSetColor={setCardColor}+ onRunQueued={runQueuedFromOmni}/>) : perProjectKanbanOpen && (<KanbanView@@ -18691,6 +18721,7 @@ export function Canvas() {nodeActionItems={activeBoardNodeActionItems}onAiName={aiNameFromActiveKanban}onSetColor={setActiveCardColor}+ onRunQueued={runActiveQueuedFromBoard}onAutoMoveFromPulls={autoMoveCardFromPulls}issueAgentMenu={issueAgentMenu}issueWorktreeMenu={issueWorktreeMenu}diff --git a/src/renderer/canvas/control-after-pr.source.test.ts b/src/renderer/canvas/control-after-pr.source.test.tsindex db672d40b..cdcf25849 100644--- a/src/renderer/canvas/control-after-pr.source.test.ts+++ b/src/renderer/canvas/control-after-pr.source.test.ts@@ -131,8 +131,10 @@ describe('the launch loop judges the wait on the ACTIVE project’s pull requestdescribe('the node badge', () => {it('a PR hold is a real hold: it is never hidden as a first-open delivery', () => {- const first = slice('const firstOpenInFlight =', '\n const ', node)- expect(first).toContain('!pendingLaunch?.afterPr')+ // The rule is shared with the board card (lib/pendingLaunch `firstOpenInFlight`).+ expect(node).toContain('isFirstOpenInFlight(!!data.initialCommand, pendingLaunch, observedLaunchDelivery)')+ const rule = slice('export function firstOpenInFlight(', '\n}\n', read('../lib/pendingLaunch.ts'))+ expect(rule).toContain('!pending?.afterPr')})it('reads EXPIRED and hands the PR wait to the tooltip', () => {diff --git a/src/renderer/canvas/toKanbanSession.ts b/src/renderer/canvas/toKanbanSession.tsindex d4b193ed7..91811971c 100644--- a/src/renderer/canvas/toKanbanSession.ts+++ b/src/renderer/canvas/toKanbanSession.ts@@ -4,6 +4,7 @@ import type { NodeIcon } from '@shared/node-icon'import { normalizeIssueRef } from '@shared/github-issue-ref'import { SYSTEM_NODE_COLORS, type CanvasNode } from '../state/workspace'import type { KanbanSession } from '../components/kanban/KanbanView'+import type { PendingLaunch } from '@shared/types'/** One canvas node as a board card, or null when this kind is not a card at all (a group frame, an* editor, a diff). The board derives its cards from the canvas live, so this is the single@@ -41,6 +42,7 @@ export function toKanbanSession(n: CanvasNode): KanbanSession | null {}}if (n.type !== 'terminal') return null+ const pending = n.data.pendingLaunch as PendingLaunch | undefinedreturn {id: n.id,title: (n.data.title as string) ?? '',@@ -51,6 +53,11 @@ export function toKanbanSession(n: CanvasNode): KanbanSession | null {// Re-validated, like everything read off node data for display: the issue card groups sessions// by this, and a malformed value must bind to nothing rather than to a wrong card.issueRef: normalizeIssueRef(n.data.issueRef),+ // The held launch always rides the card; whether a first-open launch still in flight hides the+ // chip is decided by the chip itself (lib/pendingLaunch `firstOpenInFlight`, the node's own+ // predicate), because only it reads the delivery store — a delivery that failed before the+ // `initialCommand` alias cleared must show ⚠ QUEUED on the card exactly as it does on the node.+ ...(pending ? { pendingLaunch: pending, ...(n.data.initialCommand ? { launchFirstOpen: true } : {}) } : {}),// What the card modal's co-attach terminal needs to join THIS node's session the same way the// canvas TerminalNode does.spawn: {diff --git a/src/renderer/canvas/toKanbanSessionState.ts b/src/renderer/canvas/toKanbanSessionState.tsindex 60757faf7..1393a0ef7 100644--- a/src/renderer/canvas/toKanbanSessionState.ts+++ b/src/renderer/canvas/toKanbanSessionState.ts@@ -62,6 +62,7 @@ export function toKanbanSessionState(n: CanvasNodeState): KanbanSession | null {color: n.color ?? SYSTEM_NODE_COLORS[0],kind: 'terminal',agentId: n.agentId,+ ...(n.pendingLaunch ? { pendingLaunch: n.pendingLaunch } : {}),spawn}}diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsxindex 3965aa278..ae73470ac 100644--- a/src/renderer/components/kanban/CardModal.tsx+++ b/src/renderer/components/kanban/CardModal.tsx@@ -30,6 +30,7 @@ import { isBrowserRuntime } from '@renderer/bridge/runtime'import { IssueRefChip } from '../IssueRefChip'import { TeamProgressChip } from '../TeamProgressChip'import { PortsChip } from '../PortsChip'+import { QueuedLaunchChip } from './QueuedLaunchChip'import { useProjects } from '../../state/projects'import type { TeamStation } from '../../lib/teamProgress'import { sessionNameRepeatsTitle } from '../../lib/cardRedundancy'@@ -136,13 +137,15 @@ interface CardModalProps {* row uses, so the header ✦ and the menu row cannot disagree: it reports a failure, asks the* card's OWN core, and drives the shared per-node naming spinner. */onAiName?: () => void+ /** ▶ on the header's QUEUED chip (the card's held launch). Absent = chip without ▶. */+ onRunQueued?: () => void}/** Trello-style card popup over the board. Scrim click / Esc close it; the board (and the* canvas under it) stay mounted. Terminal cards carry the node header's actions too:* search / dictate / AI-name / the ⌘M view — ChatPanel or the output markdown, the same face the* canvas node shows (the node itself is hidden under the board). */-export function CardModal({ session, projectId, projectName, projectColor, columnTitle, board, onChangeBoard, onClose, portsProjectId, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue, mentionables, team, onTravel, initialView, onSetColor, onDelete, onAiName }: CardModalProps) {+export function CardModal({ session, projectId, projectName, projectColor, columnTitle, board, onChangeBoard, onClose, portsProjectId, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue, mentionables, team, onTravel, initialView, onSetColor, onDelete, onAiName, onRunQueued }: CardModalProps) {const { api, source: coreSource } = useSession()// The header slot decides "icon or smiley" on the NORMALIZED value, the answer NodeIconView// itself gives — on the raw one, an invalid stored icon drew an empty, un-muted slot.@@ -491,6 +494,9 @@ export function CardModal({ session, projectId, projectName, projectColor, colum</div>{isTerminal && onOpenIssue && <IssueRefChip issueRef={session.issueRef} onOpen={onOpenIssue} />}{isTerminal && team && team.length > 0 && onTravel && <TeamProgressChip stations={team} onTravel={onTravel} />}+ {isTerminal && session.pendingLaunch && (+ <QueuedLaunchChip nodeId={session.id} pending={session.pendingLaunch} firstOpen={session.launchFirstOpen} onRun={onRunQueued} />+ )}{/* The same Ports chip as the canvas node header. Opening a port places the browser nodebeside this node ON THE CANVAS, so the modal hands over to the canvas to show it. */}{isTerminal && portsProjectId && (diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsxindex f6bb82f3a..963d6ec9f 100644--- a/src/renderer/components/kanban/GlobalKanbanView.tsx+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx@@ -91,10 +91,13 @@ interface SwimlaneProps {onAiName?: (projectId: string, nodeId: string) => void/** Set a card's node color (the card modal's Color button), routed by the lane's project. */onSetColor?: (projectId: string, nodeId: string, color: string) => void+ /** Start a card's held launch now (its QUEUED chip's ▶) — Canvas's `run` path, headless for a+ * background lane. */+ onRunQueued?: (projectId: string, nodeId: string) => void}const Swimlane = memo(function Swimlane({- projectId, projectName, projectIndex, projectColor, board, sessions, ropes, nodes, onChangeBoard, onOpenNode, onCreateNode, onDeleteNode, onRenameNode, onEditSticky, onBrowserNav, onSetIcon, modalNodeId, modalView, onModalChange, liveTeams, highlight, nodeActionItems, onAiName, onSetColor+ projectId, projectName, projectIndex, projectColor, board, sessions, ropes, nodes, onChangeBoard, onOpenNode, onCreateNode, onDeleteNode, onRenameNode, onEditSticky, onBrowserNav, onSetIcon, modalNodeId, modalView, onModalChange, liveTeams, highlight, nodeActionItems, onAiName, onSetColor, onRunQueued}: SwimlaneProps) {const dragRef = useRef<{ kind: 'column'; id: string } | { kind: 'card'; id: string } | null>(null)const setModalNodeId = useCallback(@@ -119,6 +122,11 @@ const Swimlane = memo(function Swimlane({},[onOpenNode, projectId])+ // Stable per lane, because SessionCard is memoized.+ const runQueued = useMemo(+ () => (onRunQueued ? (nodeId: string) => onRunQueued(projectId, nodeId) : undefined),+ [onRunQueued, projectId]+ )const customAgents = useSettings((s) => s.settings.customAgents)const disabledAgents = useSettings((s) => s.settings.disabledAgents)@@ -251,6 +259,7 @@ const Swimlane = memo(function Swimlane({liveLinkSource={liveLinkSource}ports={cardPorts}onOpenPort={openPort}+ onRunQueued={runQueued}/>))}]@@ -354,6 +363,7 @@ const Swimlane = memo(function Swimlane({onBrowserNav={(patch) => onBrowserNav(projectId, modalNodeId, patch)}onSetIcon={(icon) => onSetIcon(projectId, modalNodeId, icon)}onSetColor={onSetColor ? (color) => onSetColor(projectId, modalNodeId, color) : undefined}+ onRunQueued={runQueued ? () => runQueued(modalNodeId) : undefined}onDelete={() => onDeleteNode(projectId, modalNodeId)}onAiName={onAiName ? () => onAiName(projectId, modalNodeId) : undefined}team={teams.get(modalNodeId) ?? NO_STATIONS}@@ -386,13 +396,16 @@ export interface GlobalKanbanViewProps {onAiName?: (projectId: string, nodeId: string) => void/** Canvas's color write for a card of any lane (`setCardColor`, routed per project). Optional. */onSetColor?: (projectId: string, nodeId: string, color: string) => void+ /** Start a card's held launch now (its QUEUED chip's ▶) — Canvas's `run` path, headless for a+ * background lane. */+ onRunQueued?: (projectId: string, nodeId: string) => void/** Canvas's `setKanbanModalNode` — the same hook the per-project board reports to. It is what* makes an open card "watched" (Eco must not hibernate it), wakes a hibernated agent on open,* and points the dictation shortcut at the card instead of the selected canvas node. */onModalNodeChange?: (nodeId: string | null) => void}-export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, onModalNodeChange, nodeActionItems, onAiName, onSetColor }: GlobalKanbanViewProps) {+export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, onModalNodeChange, nodeActionItems, onAiName, onSetColor, onRunQueued }: GlobalKanbanViewProps) {// Same rule as the per-project board: the canvas is covered but mounted underneath.useEffect(() => markCanvasCovered(document.documentElement), [])const boardStyle = useBoardWallpaperStyle()@@ -547,6 +560,7 @@ export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, onnodeActionItems={nodeActionItems}onAiName={onAiName}onSetColor={onSetColor}+ onRunQueued={onRunQueued}/>)})}diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex 8a2be9084..21a86320a 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -1,6 +1,6 @@import { KanbanScopeSwitch } from './KanbanScopeSwitch'import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'-import type { KanbanColumnCategory, KanbanLabel, KanbanSavedView, KanbanViewQuery, ProjectKanban } from '@shared/types'+import type { KanbanColumnCategory, KanbanLabel, KanbanSavedView, KanbanViewQuery, PendingLaunch, ProjectKanban } from '@shared/types'import { deleteView, renameView, sameViewQuery, saveView, updateView, viewQuery } from '@shared/kanban-views'import { promptDialog } from '../promptDialog'import {@@ -93,6 +93,12 @@ export interface KanbanSession {/** The branch of the worktree the node's enclosing group is bound to (`data.worktree.branch`,* nearest bound ancestor). A pull request whose head is this branch links to the card. */worktreeBranch?: string+ /** The node's held launch (terminal cards only) — shown as QUEUED with a ▶ on the card and in its+ * modal. */+ pendingLaunch?: PendingLaunch+ /** The node's first-open `initialCommand` is still set: with no reported delivery and no hold, the+ * launch is merely in flight and the chip hides (the node hides it too — `firstOpenInFlight`). */+ launchFirstOpen?: boolean}/** What the per-column "+ New" menu can create. */@@ -142,6 +148,8 @@ export interface KanbanViewProps {onAiName?: (nodeId: string) => void/** Set a card's node color — the card modal's Color button. Optional: no button without it. */onSetColor?: (nodeId: string, color: string) => void+ /** Start a card's held launch now (its QUEUED chip's ▶) — Canvas's `run` path. */+ onRunQueued?: (nodeId: string) => void/** The board moving a session card itself because its linked pull requests merged (Canvas owns* the compare-and-set + board-log line). Optional: without it nothing ever auto-moves. */onAutoMoveFromPulls?: (@@ -241,7 +249,7 @@ function useCanvasCovered(): void {export const KanbanView = memo(function KanbanView({board, sessions, onChange, onOpenNode, onCreateNode, onRenameNode, onEditSticky, onDeleteNode,- onModalNodeChange, onBrowserNav, onSetIcon, nodeActionItems, onAiName, onSetColor, onAutoMoveFromPulls, issueAgentMenu,+ onModalNodeChange, onBrowserNav, onSetIcon, nodeActionItems, onAiName, onSetColor, onRunQueued, onAutoMoveFromPulls, issueAgentMenu,issueWorktreeMenu, teams, onIssueMoved}: KanbanViewProps) {useCanvasCovered()@@ -947,6 +955,7 @@ export const KanbanView = memo(function KanbanView({liveLinkSource={liveLinkSource}ports={cardPorts}onOpenPort={openPort}+ onRunQueued={onRunQueued}/>))})@@ -1287,6 +1296,7 @@ export const KanbanView = memo(function KanbanView({onBrowserNav={(patch) => onBrowserNav(modalNodeId, patch)}onSetIcon={(icon) => onSetIcon(modalNodeId, icon)}onSetColor={onSetColor ? (color) => onSetColor(modalNodeId, color) : undefined}+ onRunQueued={onRunQueued ? () => onRunQueued(modalNodeId) : undefined}onDelete={() => onDeleteNode(modalNodeId)}onAiName={onAiName ? () => onAiName(modalNodeId) : undefined}onOpenIssue={(ref) => {diff --git a/src/renderer/components/kanban/QueuedLaunchChip.tsx b/src/renderer/components/kanban/QueuedLaunchChip.tsxnew file mode 100644index 000000000..9c88833ca--- /dev/null+++ b/src/renderer/components/kanban/QueuedLaunchChip.tsx@@ -0,0 +1,66 @@+import type { PendingLaunch } from '@shared/types'+import { useLaunchDelivery } from '../../state/launchDelivery'+import { firstOpenInFlight, launchTooltip } from '../../lib/pendingLaunch'+import { IconPlay } from '../icons'++/**+ * The canvas node's QUEUED chip, on the board: a session card and its card modal. A held launch+ * (`--after`, a setup gate, a cold open, a failed delivery) used to be visible ONLY on the canvas+ * node, so from the board a queued session looked idle and could not be started. ▶ runs the same+ * path as the `run` verb (Canvas `runQueuedNodeRef`): the mounted node's writer when its project is+ * on the canvas, a headless start when it is a background Omni lane.+ *+ * Deliberately smaller than the node's chip: the board does not hold the canvas's dep titles or the+ * PR / success-wait state, so the tooltip names the dependency ids and the command, nothing it+ * cannot see.+ */+export function QueuedLaunchChip({+ nodeId,+ pending,+ firstOpen = false,+ onRun,+ className = ''+}: {+ nodeId: string+ pending: PendingLaunch+ /** The node's first-open `initialCommand` is still set (`KanbanSession.launchFirstOpen`). */+ firstOpen?: boolean+ /** Absent = no ▶ (a board with no run wiring). A relay tab DOES get ▶: Canvas answers it with a+ * notice that the launch runs on the host, rather than starting anything here. */+ onRun?: () => void+ className?: string+}) {+ const observed = useLaunchDelivery((s) => s.byId[nodeId])+ if (firstOpenInFlight(firstOpen, pending, observed)) return null+ const delivery = observed ?? (pending.manualOnly ? { kind: 'failed' as const, attempts: 1, at: 0 } : undefined)+ const starting = delivery?.kind === 'starting'+ const waitingOn = (pending.after ?? []).join(', ')+ return (+ <span+ className={`term-node__status term-node__status--queued kanban-queued${+ delivery && !starting ? ' term-node__status--queued-warn' : ''+ } ${className}`}+ title={launchTooltip(delivery, waitingOn, pending.command, undefined, !onRun)}+ onClick={(e) => e.stopPropagation()}+ onDoubleClick={(e) => e.stopPropagation()}+ >+ <span className="term-node__status-dot" />+ {starting ? 'STARTING' : delivery ? '⚠ QUEUED' : 'QUEUED'}+ {onRun && (+ <button+ type="button"+ className="term-node__queued-run"+ aria-label="Run now"+ disabled={starting}+ title={starting ? 'Starting in the background' : pending.manualOnly ? 'Retry launch at a shell prompt' : 'Run now without waiting'}+ onClick={(e) => {+ e.stopPropagation()+ onRun()+ }}+ >+ <IconPlay />+ </button>+ )}+ </span>+ )+}diff --git a/src/renderer/components/kanban/SessionCard.queued.test.tsx b/src/renderer/components/kanban/SessionCard.queued.test.tsxnew file mode 100644index 000000000..f6cc60111--- /dev/null+++ b/src/renderer/components/kanban/SessionCard.queued.test.tsx@@ -0,0 +1,109 @@+// @vitest-environment jsdom+//+// A held launch is visible on the board and can be started from it: the card shows the canvas+// node's QUEUED chip, and ▶ asks the board to run it without opening the card.+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { SessionCard } from './SessionCard'+import type { KanbanSession } from './KanbanView'+import { useLaunchDelivery } from '../../state/launchDelivery'+import { toKanbanSession } from '../../canvas/toKanbanSession'+import type { CanvasNode } from '../../state/workspace'++vi.mock('../ContextMeter', () => ({ ContextMeter: () => null }))++const queued: KanbanSession = {+ id: 'n1',+ title: 'reviewer',+ color: '#fff',+ kind: 'terminal',+ spawn: {},+ pendingLaunch: { after: ['a1'], command: 'claude' }+}++let root: Root+let host: HTMLDivElement+beforeEach(() => {+ ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true+ host = document.createElement('div')+ document.body.append(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ document.body.innerHTML = ''+ useLaunchDelivery.setState({ byId: {} })+})++function render(session: KanbanSession, extra: { onRunQueued?: (id: string) => void; onOpen?: (id: string) => void } = {}): void {+ const noop = (): void => {}+ act(() =>+ root.render(+ <SessionCard+ session={session}+ onOpen={extra.onOpen ?? noop}+ onDragStart={noop}+ onDragEnd={noop}+ onDropAt={noop}+ onContext={noop}+ liveLinkSource="local"+ onRunQueued={extra.onRunQueued}+ />+ )+ )+}++describe('SessionCard — QUEUED chip', () => {+ it('shows QUEUED, and ▶ runs the launch without opening the card', () => {+ const onRunQueued = vi.fn()+ const onOpen = vi.fn()+ render(queued, { onRunQueued, onOpen })+ const chip = document.querySelector<HTMLElement>('.kanban-queued')+ expect(chip?.textContent).toContain('QUEUED')+ act(() => chip!.querySelector<HTMLButtonElement>('.term-node__queued-run')!.click())+ expect(onRunQueued).toHaveBeenCalledWith('n1')+ expect(onOpen).not.toHaveBeenCalled()+ })++ it('no held launch, no chip', () => {+ render({ ...queued, pendingLaunch: undefined }, { onRunQueued: vi.fn() })+ expect(document.querySelector('.kanban-queued')).toBeNull()+ })++ it('a failed delivery reads ⚠ QUEUED; a headless start reads STARTING with ▶ disabled', () => {+ useLaunchDelivery.getState().markFailed('n1', 1)+ render(queued, { onRunQueued: vi.fn() })+ expect(document.querySelector('.kanban-queued')?.textContent).toContain('⚠ QUEUED')+ act(() => useLaunchDelivery.getState().markStarting('n1'))+ expect(document.querySelector('.kanban-queued')?.textContent).toContain('STARTING')+ expect(document.querySelector<HTMLButtonElement>('.term-node__queued-run')?.disabled).toBe(true)+ })++ it('without a run handler the chip shows but has no ▶', () => {+ render(queued)+ expect(document.querySelector('.kanban-queued')).not.toBeNull()+ expect(document.querySelector('.term-node__queued-run')).toBeNull()+ })++ // A node's own first open: `initialCommand` is still set and nothing holds the launch. The node+ // hides its chip while the delivery is merely in flight, and shows ⚠ QUEUED once the delivery+ // loop reports a failure — the card must follow the SAME rule, so it is derived from the node.+ const firstOpenNode = {+ id: 'n1',+ type: 'terminal',+ position: { x: 0, y: 0 },+ data: { title: 'agent', initialCommand: 'claude', pendingLaunch: { command: 'claude', manualOnly: true } }+ } as unknown as CanvasNode++ it("a first open still in flight shows no chip, like the node", () => {+ render(toKanbanSession(firstOpenNode)!, { onRunQueued: vi.fn() })+ expect(document.querySelector('.kanban-queued')).toBeNull()+ })++ it('a first open whose delivery failed shows ⚠ QUEUED, like the node', () => {+ useLaunchDelivery.getState().markFailed('n1', 1)+ render(toKanbanSession(firstOpenNode)!, { onRunQueued: vi.fn() })+ expect(document.querySelector('.kanban-queued')?.textContent).toContain('⚠ QUEUED')+ })+})diff --git a/src/renderer/components/kanban/SessionCard.tsx b/src/renderer/components/kanban/SessionCard.tsxindex 39602517a..4ff476be2 100644--- a/src/renderer/components/kanban/SessionCard.tsx+++ b/src/renderer/components/kanban/SessionCard.tsx@@ -22,6 +22,7 @@ import { TeamProgressChip } from '../TeamProgressChip'import type { TeamStation } from '../../lib/teamProgress'import { cardShowsOverdue, sessionNameRepeatsTitle } from '../../lib/cardRedundancy'import { PortsChip } from '../PortsChip'+import { QueuedLaunchChip } from './QueuedLaunchChip'const PRIO_COLOR = Object.fromEntries(PRIORITIES.map((p) => [p.id, p.color])) as Record<KanbanPriority, string>@@ -61,11 +62,14 @@ interface SessionCardProps {ports?: { projectId: string; remote: boolean }/** A port row was picked: open it in a browser node beside the card's node (on the canvas). */onOpenPort?: (nodeId: string, url: string) => void+ /** ▶ on the card's QUEUED chip: start the node's held launch now (Canvas's `run` path; on a relay+ * tab Canvas answers with a "runs on the host" notice instead). Absent = the chip shows without ▶. */+ onRunQueued?: (nodeId: string) => void}export const SessionCard = memo(function SessionCard({session, meta, labels = [], onOpen, onDragStart, onDragEnd, onDropAt, onContext, pulls,- pullFreshness = 'fresh', onOpenIssue, team, onTravel, columnCategory, liveLinkSource, ports, onOpenPort+ pullFreshness = 'fresh', onOpenIssue, team, onTravel, columnCategory, liveLinkSource, ports, onOpenPort, onRunQueued}: SessionCardProps) {// THIS card's agent status, subscribed per card rather than threaded down from the board.// KanbanView used to hold `useAgentStatus((s) => s.byId)` and pass the map through the column:@@ -164,6 +168,14 @@ export const SessionCard = memo(function SessionCard({{session.kind === 'terminal' && team && team.length > 0 && onTravel && (<TeamProgressChip stations={team} onTravel={onTravel} />)}+ {session.kind === 'terminal' && session.pendingLaunch && (+ <QueuedLaunchChip+ nodeId={session.id}+ pending={session.pendingLaunch}+ firstOpen={session.launchFirstOpen}+ onRun={onRunQueued ? () => onRunQueued(session.id) : undefined}+ />+ )}{/* The canvas node header's Ports chip — one component, so the two views of a sessioncannot disagree. It stops its own clicks, so opening it never opens the card. */}{session.kind === 'terminal' && ports && onOpenPort && (diff --git a/src/renderer/lib/boardRunQueued.test.ts b/src/renderer/lib/boardRunQueued.test.tsnew file mode 100644index 000000000..b8a6d6433--- /dev/null+++ b/src/renderer/lib/boardRunQueued.test.ts@@ -0,0 +1,19 @@+import { describe, expect, it } from 'vitest'+import { runQueuedNotice } from './boardRunQueued'++describe('runQueuedNotice', () => {+ it('a refusal shows its sentence without the agent-facing code', () => {+ expect(+ runQueuedNotice({ ok: false, error: 'run-not-mounted: n1 is on screen but its terminal is not mounted' }, 'dev')+ ).toEqual({ kind: 'error', text: 'Could not start "dev": n1 is on screen but its terminal is not mounted' })+ })+ it('a start raises nothing (the chip leaves the card)', () => {+ expect(runQueuedNotice({ ok: true, result: { started: true } }, 'dev')).toBeNull()+ })+ it('still queued says why', () => {+ expect(runQueuedNotice({ ok: true, result: { started: false, reason: 'no-shell' } }, 'dev')).toEqual({+ kind: 'info',+ text: '"dev" stays queued (no-shell).'+ })+ })+})diff --git a/src/renderer/lib/boardRunQueued.ts b/src/renderer/lib/boardRunQueued.tsnew file mode 100644index 000000000..8425c140f--- /dev/null+++ b/src/renderer/lib/boardRunQueued.ts@@ -0,0 +1,27 @@+/**+ * What the board says after ▶ on a card's QUEUED chip. The start itself is Canvas's `run` path+ * (`runQueuedNodeRef`), whose answer was written for an agent: `ok:false` + an `error` code, or+ * `ok:true` with `result.started` and, when it did not start, `result.reason`.+ *+ * Returns the strip to raise, or null for none. Pure, so the wording is testable without a canvas.+ */+export type RunQueuedReply = {+ ok: boolean+ error?: string+ result?: unknown+}++export type BoardNotice = { kind: 'info' | 'error'; text: string }++export function runQueuedNotice(reply: RunQueuedReply, title: string): BoardNotice | null {+ if (!reply.ok) {+ // "<code>: <sentence>" — the code is for agents; the sentence is already written for a person.+ const raw = reply.error ?? 'unknown error'+ const sentence = raw.replace(/^[a-z-]+:\s*/, '')+ return { kind: 'error', text: `Could not start "${title}": ${sentence}` }+ }+ const result = (reply.result ?? {}) as { started?: boolean; reason?: string }+ // Started: the chip leaves the card, and a headless start raises its own "Go there" strip.+ if (result.started) return null+ return { kind: 'info', text: `"${title}" stays queued (${result.reason ?? 'not started'}).` }+}diff --git a/src/renderer/lib/pendingLaunch.test.ts b/src/renderer/lib/pendingLaunch.test.tsindex d9f43150a..2b5885310 100644--- a/src/renderer/lib/pendingLaunch.test.ts+++ b/src/renderer/lib/pendingLaunch.test.ts@@ -1,6 +1,7 @@import { describe, it, expect, vi } from 'vitest'import type { PendingLaunch } from '@shared/types'import {+ firstOpenInFlight,launchesToFire,queueControlLaunch,controlLaunchState,@@ -676,3 +677,18 @@ describe('launchBriefPresent — only a definite "not there" holds a launch', ()expect(exists).not.toHaveBeenCalled()})})++describe('firstOpenInFlight (one rule for the canvas node and the board card)', () => {+ const plain: PendingLaunch = { after: [], command: 'claude', manualOnly: true }+ it('is in flight only with the initialCommand alias, no reported delivery and no hold', () => {+ expect(firstOpenInFlight(true, plain, undefined)).toBe(true)+ expect(firstOpenInFlight(false, plain, undefined)).toBe(false)+ })+ it('a reported delivery (failed, stalled, starting) is no longer "in flight"', () => {+ expect(firstOpenInFlight(true, plain, { kind: 'failed', attempts: 1, at: 0 })).toBe(false)+ })+ it('a real hold always shows', () => {+ expect(firstOpenInFlight(true, { ...plain, after: ['a1'] }, undefined)).toBe(false)+ expect(firstOpenInFlight(true, { ...plain, awaitSetupGroup: 'g1' }, undefined)).toBe(false)+ })+})diff --git a/src/renderer/lib/pendingLaunch.ts b/src/renderer/lib/pendingLaunch.tsindex 12689f51a..1bc3181e9 100644--- a/src/renderer/lib/pendingLaunch.ts+++ b/src/renderer/lib/pendingLaunch.ts@@ -423,6 +423,30 @@ export function deliveriesToRetire(* `starting` comes first, ahead even of the relay sentence: while core is typing the launch, no* sentence may offer ▶, and "waiting for X" would describe a wait that is already over.*/+/**+ * A node's own first-open launch is in flight: the live `initialCommand` alias is still set (it is+ * cleared on every outcome), the delivery loop has reported nothing, and nothing holds it. Its+ * `pendingLaunch` is then only the durable write-ahead record — and it carries `manualOnly` from the+ * claim until Enter lands — so a QUEUED chip there would paint "⚠ QUEUED" on EVERY freshly opened+ * agent for the length of its delivery. A real hold (deps, setup script, PR / success wait) or a+ * reported failure/stall still shows. ONE rule for the canvas node and the board card, so the two+ * views of a session cannot disagree about whether it is queued.+ */+export function firstOpenInFlight(+ hasInitialCommand: boolean,+ pending: PendingLaunch | undefined,+ observedDelivery: LaunchDelivery | undefined+): boolean {+ return (+ hasInitialCommand &&+ !observedDelivery &&+ !pending?.after?.length &&+ !pending?.awaitSetupGroup &&+ !pending?.afterPr &&+ !pending?.afterSuccess+ )+}+export function launchTooltip(delivery: LaunchDelivery | undefined,waitingOn: string,diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex f1f118967..63ca221fc 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -274,7 +274,7 @@ import { useCodexIdentity, codexSharedIdentity, codexFallbackText } from '../staimport { ensureCodexLaunchCaps } from '../state/codexCli'import { useAgentStatus, agentStatusForApi, inferInterruptAfterSettle } from '../state/agentStatus'import { useLaunchDelivery } from '../state/launchDelivery'-import { erroredDeps, handedOverDeps, holdReason, interruptedDeps, launchTooltip } from '../lib/pendingLaunch'+import { erroredDeps, firstOpenInFlight as isFirstOpenInFlight, handedOverDeps, holdReason, interruptedDeps, launchTooltip } from '../lib/pendingLaunch'import { useStationHandovers } from '../state/stationHandovers'import { useSuccessWait } from '../lib/useSuccessWait'import { StationFailedChip } from '../components/StationFailedChip'@@ -2140,18 +2140,9 @@ export function TerminalNode({// A headless start (#925) is typing this node's launch from core: the badge says so, without the// warning, and ▶ stands aside — a click would splice a second copy into the pane.const startingNow = launchDelivery?.kind === 'starting'- // A node's own first-open launch is in flight: the live `initialCommand` alias is still set- // (it is cleared on every outcome) and nothing holds it. Its `pendingLaunch` is only the durable- // write-ahead record — and it carries `manualOnly` from the claim until Enter lands — so showing- // the chip here painted "⚠ QUEUED" on EVERY freshly opened agent for the length of its delivery.- // A real hold (deps, setup script) or a reported failure/stall still shows.- const firstOpenInFlight =- !!data.initialCommand &&- !observedLaunchDelivery &&- !(pendingLaunch?.after?.length) &&- !pendingLaunch?.awaitSetupGroup &&- !pendingLaunch?.afterPr &&- !pendingLaunch?.afterSuccess+ // A node's own first-open launch still in flight hides the chip (lib/pendingLaunch — the board+ // card asks the same predicate).+ const firstOpenInFlight = isFirstOpenInFlight(!!data.initialCommand, pendingLaunch, observedLaunchDelivery)// `--after-success`: where the wait stands (lib/useSuccessWait — the hold through the shape rule,// its stations, and the tooltip, which flips to EXPIRED on its own deadline tick).const successWait = useSuccessWait(