fix(cron): publish agent response to bus after ProcessDirectWithChannel
When a cron job with deliver=false runs, the agent response was silently discarded with a misleading comment "Will be sent by AgentLoop". The Run loop is never involved in cron execution — ProcessDirectWithChannel bypasses it entirely. As a result, Karen's response to scheduled tasks was computed but never delivered to Slack (or any other channel). Fix: explicitly publish the response via msgBus.PublishOutbound after ProcessDirectWithChannel returns, consistent with how command and deliver=true jobs already handle their output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de1342f7fe
commit
9cff725226
1 changed files with 9 additions and 2 deletions
|
|
@ -341,7 +341,14 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
|
||||||
return fmt.Sprintf("Error: %v", err)
|
return fmt.Sprintf("Error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response is automatically sent via MessageBus by AgentLoop
|
if response != "" {
|
||||||
_ = response // Will be sent by AgentLoop
|
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"
|
return "ok"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue