fix(broadcast): exclude sender from recipients

Prevents gt broadcast from nudging the sender's own session,
which would interrupt the command mid-execution with exit 137.

Fixes: gt-y5ss

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
max
2026-01-17 03:18:55 -08:00
committed by Steve Yegge
parent 88a74c50f7
commit d4ad4c0726

View File

@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"os"
"time"
"github.com/spf13/cobra"
@@ -55,6 +56,9 @@ func runBroadcast(cmd *cobra.Command, args []string) error {
return fmt.Errorf("listing sessions: %w", err)
}
// Get sender identity to exclude self
sender := os.Getenv("BD_ACTOR")
// Filter to target agents
var targets []*AgentSession
for _, agent := range agents {
@@ -70,6 +74,11 @@ func runBroadcast(cmd *cobra.Command, args []string) error {
}
}
// Skip self to avoid interrupting own session
if sender != "" && formatAgentName(agent) == sender {
continue
}
targets = append(targets, agent)
}