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
fix(inbox): answering on the desktop clears the card — a new ask settles the old one
enes71d0be2b9e68
diff --git a/src/core/agent-status-mirror.test.ts b/src/core/agent-status-mirror.test.tsindex e3bb1b442..0db7f3c32 100644--- a/src/core/agent-status-mirror.test.ts+++ b/src/core/agent-status-mirror.test.ts@@ -1563,3 +1563,44 @@ describe('idle_prompt rescue (Esc that ran no Stop hook)', () => {expect(next.updatedAt).toBe(1000)})})+++describe('consecutive asks (answered on the desktop)', () => {+ it('a new ask settles the previous card and refreshes the live-update', () => {+ _resetForTest()+ const edges: NodeStateChange[] = []+ const un = onNodeStateChange((c) => edges.push(c))++ // Ask #1 — the edge into needs-you fires and a card appears.+ recordAgentEvent(ev({ nodeId: 'n1', state: 'blocked', lastMessage: 'Edit App.tsx?' }))+ const first = _inboxSnapshot().events.filter((e) => e.nodeId === 'n1' && e.kind === 'approval')+ expect(first).toHaveLength(1)+ expect(edges.filter((e) => e.state === 'needsYou')).toHaveLength(1)++ // The user answers in the terminal; the agent immediately asks something else. The node never+ // leaves `blocked`, which is exactly why the old card used to linger forever.+ edges.length = 0+ recordAgentEvent(ev({ nodeId: 'n1', state: 'blocked', lastMessage: 'Run npm test?' }))+ const cards = _inboxSnapshot().events.filter((e) => e.nodeId === 'n1' && e.kind === 'approval')+ expect(cards).toHaveLength(2)+ expect(cards.find((c) => c.title === 'Edit App.tsx?')?.resolved).toBe(true)+ expect(cards.find((c) => c.title === 'Run npm test?')?.resolved).toBeFalsy()+ // …and the Lock Screen / island is told about the CURRENT ask, not left on the answered one.+ const needs = edges.filter((e) => e.state === 'needsYou')+ expect(needs).toHaveLength(1)+ expect(needs[0].message).toContain('Run npm test?')+ un()+ })++ it('a re-asserted SAME ask still fires nothing and adds no card', () => {+ _resetForTest()+ const edges: NodeStateChange[] = []+ const un = onNodeStateChange((c) => edges.push(c))+ recordAgentEvent(ev({ nodeId: 'n2', state: 'blocked', lastMessage: 'Edit App.tsx?' }))+ edges.length = 0+ recordAgentEvent(ev({ nodeId: 'n2', state: 'blocked', lastMessage: 'Edit App.tsx?' }))+ expect(_inboxSnapshot().events.filter((e) => e.nodeId === 'n2')).toHaveLength(1)+ expect(edges.filter((e) => e.state === 'needsYou')).toHaveLength(0)+ un()+ })+})diff --git a/src/core/agent-status-mirror.ts b/src/core/agent-status-mirror.tsindex d5eb5dae0..47e0f5a69 100644--- a/src/core/agent-status-mirror.ts+++ b/src/core/agent-status-mirror.ts@@ -1159,7 +1159,23 @@ function produceInboxFromState(// The live-update headline folds the approval detail in (so Live Activities / push alerts read// "Edit App.tsx — src/components/App.tsx +2 −2"); a question / detail-less approval is just the title.const headline = clip(detail ? `${title} — ${detail}` : title, LIVE_MESSAGE_MAX)- if (prevState !== nextState) {+ // Dedup a re-asserted SAME ask (title match) — BOUNDED (QUESTION_DEDUP_WINDOW_MS): only an+ // unresolved same-title event still inside the window suppresses. A stale lingering same-title one+ // (restored across a restart, or a long-abandoned turn) is SUPERSEDED — marked resolved so it+ // stops muzzling — and the new ask fires. A different-title unresolved event never suppresses:+ // that is a genuinely NEW ask. Always return the classification below so the broadcast+ // enrichment stays consistent across the re-assert.+ const dup = newestUnresolved(inboxEvents, nodeId)+ const sameTitle = !!dup && dup.title === title+ const freshDup = sameTitle && dup ? now - dup.ts < QUESTION_DEDUP_WINDOW_MS : false+ const newAsk = !freshDup+ // The needs-you live-update fires on the edge INTO needs-you — and also whenever the ASK+ // ITSELF changes while we stay there. An agent asks in sequence: you answer on the desktop, it+ // immediately asks the next thing, and the state never leaves `blocked`. Firing only on the+ // state edge left the Lock Screen / island showing the ANSWERED question, with its options and+ // its hook-reply ticket — stale, and answerable into the wrong ask (field report: "cevap+ // vermeme rağmen gitmiyor"). A re-asserted SAME ask still fires nothing.+ if (prevState !== nextState || newAsk) {fireNodeStateChange({...stateBase,event: 'update',@@ -1171,17 +1187,12 @@ function produceInboxFromState(...(pendingId ? { pendingId } : {})})}- // Dedup a re-asserted SAME ask (title match) — BOUNDED (QUESTION_DEDUP_WINDOW_MS): only an- // unresolved same-title event still inside the window suppresses. A stale lingering same-title one- // (restored across a restart, or a long-abandoned turn) is SUPERSEDED — marked resolved so it- // stops muzzling — and the new ask fires. A different-title unresolved event never suppresses (a- // genuinely new ask) and is left untouched (it may still be pending). Always return the- // classification below so the broadcast enrichment stays consistent across the re-assert.- const dup = newestUnresolved(inboxEvents, nodeId)- const sameTitle = !!dup && dup.title === title- const freshDup = sameTitle && dup ? now - dup.ts < QUESTION_DEDUP_WINDOW_MS : false- if (!freshDup) {- if (sameTitle && dup) dup.resolved = true // supersede the stale same-title card+ if (newAsk) {+ // A NEW ask settles every older one for this node: the CLI blocks on an ask, so it cannot be+ // asking something else unless the previous one was answered. Without this the Inbox kept a+ // card per ask and the user had to dismiss answered questions by hand — the state never+ // leaves `blocked` between them, so the transition-based resolve never ran.+ resolveUnresolvedFor(nodeId)pushInboxEvent({...baseEvent,kind,