diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index c4479434f..b05f02c6e 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -679,6 +679,12 @@ func (al *AgentLoop) ProcessDirectWithChannel( Content: content, SessionKey: sessionKey, } + // Set peer so channel-based bindings (e.g. a specific Slack channel mapped + // to a named agent) are matched by the route resolver, exactly as they are + // for live inbound messages. + if chatID != "" && chatID != "direct" { + msg.Peer = bus.Peer{Kind: "channel", ID: chatID} + } return al.processMessage(ctx, msg) }