fix(cron): set peer on inbound message so channel bindings route correctly
Cron jobs fired via ProcessDirectWithChannel had no Peer set on the
InboundMessage, so the route resolver never matched peer-based bindings
and always fell through to the default agent.
Setting Peer{Kind: "channel", ID: chatID} when a real chatID is present
means a cron job targeted at a specific Slack channel ID will now be
routed to whichever agent has a matching peer binding for that channel,
consistent with how live inbound messages are routed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
74740f9c87
commit
de1342f7fe
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue