From 4307c3a28accc5753180d5390a5fbad4da959277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B7=AF=E8=B7=AF?= Date: Wed, 4 Mar 2026 12:18:23 +0800 Subject: [PATCH] fix(cron): publish agent response for deliver=false cron tasks ProcessDirectWithChannel returns the LLM response but does not publish it via MessageBus (only the Run() inbound loop does that). ExecuteJob was discarding the response with '_ = response', causing deliver=false cron task results to never reach the target channel. Now publish the response explicitly, matching the deliver=true and command execution paths. --- pkg/tools/cron.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/tools/cron.go b/pkg/tools/cron.go index 6888d1326..e876b9725 100644 --- a/pkg/tools/cron.go +++ b/pkg/tools/cron.go @@ -337,7 +337,16 @@ 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 + // Send agent response to channel (ProcessDirectWithChannel does not + // publish on its own — only the Run() inbound loop does that). + if response != "" { + pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second) + defer pubCancel() + t.msgBus.PublishOutbound(pubCtx, bus.OutboundMessage{ + Channel: channel, + ChatID: chatID, + Content: response, + }) + } return "ok" }