fix(cron): publish agent response to outbound bus after ProcessDirectWithChannel

ProcessDirectWithChannel bypasses the AgentLoop bus, so the Run() loop's
PublishOutbound never fires. The response was silently discarded with _ = response,
causing cron-triggered agent replies to never reach the Telegram channel.

Fix by explicitly calling PublishOutbound with the response when non-empty,
consistent with the deliver=true and command execution paths.
This commit is contained in:
mantrahq502 2026-02-25 11:16:34 +08:00
parent bec8e13cf7
commit fae3cef6aa

View file

@ -327,7 +327,12 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
return fmt.Sprintf("Error: %v", err)
}
// Response is automatically sent via MessageBus by AgentLoop
_ = response // Will be sent by AgentLoop
if response != "" {
t.msgBus.PublishOutbound(bus.OutboundMessage{
Channel: channel,
ChatID: chatID,
Content: response,
})
}
return "ok"
}