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.
This commit is contained in:
parent
df1b53fdf9
commit
4307c3a28a
1 changed files with 11 additions and 2 deletions
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue