From 38d4147b55241602143a9ffdec24d343d417a53d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 26 Dec 2025 13:34:43 +0000 Subject: [PATCH] fix: Update spawner tests for -- separator and fix broadcast detection - Update spawner.test.ts expectations to include '--' separator between agent-relay options and the wrapped command (matching implementation) - Fix needs-attention.ts to detect broadcasts via both isBroadcast flag and to === '*' pattern for backwards compatibility --- src/bridge/spawner.test.ts | 6 +++--- src/dashboard/needs-attention.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/bridge/spawner.test.ts b/src/bridge/spawner.test.ts index c31c379ce..928361a98 100644 --- a/src/bridge/spawner.test.ts +++ b/src/bridge/spawner.test.ts @@ -102,7 +102,7 @@ describe('AgentSpawner', () => { expect(execAsyncMock).toHaveBeenNthCalledWith(1, `tmux has-session -t ${session} 2>/dev/null`); expect(execAsyncMock).toHaveBeenNthCalledWith(2, `tmux new-window -t ${session} -n Dev1 -c "${projectRoot}"`); expect(execAsyncMock).toHaveBeenNthCalledWith(3, 'which agent-relay'); // Find full path - expect(execAsyncMock).toHaveBeenNthCalledWith(4, `tmux send-keys -t ${session}:Dev1 'unset TMUX && /usr/local/bin/agent-relay -n Dev1 claude --dangerously-skip-permissions' Enter`); + expect(execAsyncMock).toHaveBeenNthCalledWith(4, `tmux send-keys -t ${session}:Dev1 'unset TMUX && /usr/local/bin/agent-relay -n Dev1 -- claude --dangerously-skip-permissions' Enter`); expect(execAsyncMock).toHaveBeenNthCalledWith(5, `tmux send-keys -t ${session}:Dev1 -l "escaped:Finish the report"`); expect(execAsyncMock).toHaveBeenNthCalledWith(6, `tmux send-keys -t ${session}:Dev1 Enter`); expect(sleepMock).toHaveBeenCalledWith(100); @@ -124,7 +124,7 @@ describe('AgentSpawner', () => { // Check that the command includes --dangerously-skip-permissions for claude:opus expect(execAsyncMock).toHaveBeenNthCalledWith( 4, - `tmux send-keys -t ${session}:Opus1 'unset TMUX && /usr/local/bin/agent-relay -n Opus1 claude:opus --dangerously-skip-permissions' Enter` + `tmux send-keys -t ${session}:Opus1 'unset TMUX && /usr/local/bin/agent-relay -n Opus1 -- claude:opus --dangerously-skip-permissions' Enter` ); }); @@ -144,7 +144,7 @@ describe('AgentSpawner', () => { // Check that the command does NOT include --dangerously-skip-permissions for codex expect(execAsyncMock).toHaveBeenNthCalledWith( 4, - `tmux send-keys -t ${session}:Codex1 'unset TMUX && /usr/local/bin/agent-relay -n Codex1 codex' Enter` + `tmux send-keys -t ${session}:Codex1 'unset TMUX && /usr/local/bin/agent-relay -n Codex1 -- codex' Enter` ); }); diff --git a/src/dashboard/needs-attention.ts b/src/dashboard/needs-attention.ts index d0e709176..43036f8b4 100644 --- a/src/dashboard/needs-attention.ts +++ b/src/dashboard/needs-attention.ts @@ -46,10 +46,13 @@ export function computeNeedsAttention(messages: AttentionMessage[]): Set const ts = Date.parse(message.timestamp); if (Number.isNaN(ts)) continue; + // Detect broadcasts: either explicit isBroadcast flag or to === '*' + const isBroadcast = message.isBroadcast || message.to === '*'; + // Inbound: messages directed to a specific agent (ignore broadcasts) // Note: isBroadcast indicates the message was originally a broadcast, even though // the 'to' field is set to the individual recipient for storage purposes - if (message.to && !message.isBroadcast) { + if (message.to && !isBroadcast) { const inboundKey = message.thread ? `thread:${message.thread}` : `sender:${message.from}`; updateLatest(latestInbound, message.to, inboundKey, ts); } @@ -59,7 +62,7 @@ export function computeNeedsAttention(messages: AttentionMessage[]): Set if (message.from) { const outboundKey = message.thread ? `thread:${message.thread}` - : (message.to && !message.isBroadcast) + : (message.to && !isBroadcast) ? `sender:${message.to}` : null; @@ -69,7 +72,7 @@ export function computeNeedsAttention(messages: AttentionMessage[]): Set // Broadcasts clear attention: agent is actively participating // Track as a "catch-all" outbound timestamp for this agent - if (message.isBroadcast) { + if (isBroadcast) { updateLatest(latestOutbound, message.from, '__broadcast__', ts); } }