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(agent-status): reading a session clears it everywhere, even unwatched
enes4742a418b7ac
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 72e3e2862..4d946fdca 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -5409,6 +5409,11 @@ export function Canvas() {// or with nothing focused, still flags unread.const watching = document.hasFocus() && cs.activeId === e.nodeIdif (!watching) cs.markUnread(e.nodeId)+ // Watched it finish? Then it is already read. Nothing marks it unread in this branch, so+ // without an explicit ack there would never BE a read signal — and the notch capsule's+ // green blob and the phone's Live Activity would keep glowing for a turn the user sat and+ // watched end. The mirror no-ops when there is no unresolved done event.+ else if (sound === 'done') void window.nodeTerminal.ackDone(e.nodeId)// Sound first: it is the one alert that also fires while you're in the app but looking at// another node — the case OS notifications deliberately skip.const snd = useSettings.getState().settingsdiff --git a/src/renderer/state/agentStatus.test.ts b/src/renderer/state/agentStatus.test.tsindex 8e62ff135..0860a974d 100644--- a/src/renderer/state/agentStatus.test.ts+++ b/src/renderer/state/agentStatus.test.ts@@ -132,6 +132,18 @@ describe('clearUnread — cross-surface ack vs. external (host-driven) clear', (expect(acked).toEqual([])})+ it('acks a done with NO unread flag — the session the user watched finish', () => {+ const acked: string[] = []+ const { store } = createAgentStatusSession(undefined, (id) => acked.push(id))+ const id = 'nt-watched'+ // Watching the node when it finished means markUnread was skipped, so opening it is the only+ // read signal there will ever be. Without this ack the notch blob / phone activity kept glowing.+ store.getState().setState(id, 'done', 'claude')+ store.getState().clearUnread(id)+ expect(acked).toEqual(['nt-watched'])+ expect(store.getState().byId[id].unread).toBeFalsy()+ })+it('a non-done unread clear never acks (regardless of the external flag)', () => {const acked: string[] = []const { store } = createAgentStatusSession(undefined, (id) => acked.push(id))diff --git a/src/renderer/state/agentStatus.ts b/src/renderer/state/agentStatus.tsindex 5eec6d893..3e44061bf 100644--- a/src/renderer/state/agentStatus.ts+++ b/src/renderer/state/agentStatus.ts@@ -309,15 +309,21 @@ export function createAgentStatusSession(clearUnread: (id, opts) =>set((s) => {const prev = s.byId[id]- if (!prev?.unread) return s- // Cross-surface ACK: reading a FINISHED session here dismisses the paired phone's lingering- // DONE Live Activity and marks its Inbox card seen (via the core mirror's `ackDone`). Gated- // on the node's LATEST state being `done` — a working-state focus (unread from an earlier- // turn while a new turn is now live) must not ack. Fire-and-forget; the mirror no-ops when- // there is no unresolved done event, so a stray call is harmless + idempotent.- // SUPPRESSED for an `external` clear — one the host drove FROM a phone read-ack it swept- // (`agent:unread-clear`): re-acking here would loop host→renderer→ackDone straight back.+ if (!prev) return s+ // The ACK runs even when there is no unread flag to clear. A session you were LOOKING at+ // when it finished never got marked unread (see the `watching` gate in Canvas), so opening+ // it is the only "I read it" signal there will ever be — and without the ack the notch+ // capsule and the phone's Live Activity kept glowing for a session the user watched end.+ // `ackDone` is a no-op when there is no unresolved done event, so a stray call costs+ // nothing.+ // Cross-surface ACK: reading a FINISHED session dismisses the paired phone's lingering DONE+ // Live Activity, clears the notch capsule's green blob and marks its Inbox card seen (all+ // via the core mirror's `ackDone`). Gated on the node's LATEST state being `done` — a+ // working-state focus (unread from an earlier turn while a new turn is now live) must not+ // ack. SUPPRESSED for an `external` clear — one the host drove FROM a phone read-ack it+ // swept (`agent:unread-clear`): re-acking would loop host→renderer→ackDone straight back.if (prev.state === 'done' && !opts?.external) ackDone?.(id)+ if (!prev.unread) return sconst byId = { ...s.byId, [id]: { ...prev, unread: false } }save(byId)return { byId }