fix(cron): make each job execution use an independent session

Previously all executions of the same cron job reused the session key
"cron-{jobID}", causing conversation history to accumulate across runs.
Now each run gets a unique key "cron-{jobID}-{timestamp}", preventing
cross-execution interference.
This commit is contained in:
srcrs 2026-04-10 23:16:00 +08:00
parent 748ac58dd1
commit 36b9693d31

View file

@ -342,7 +342,7 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
return "ok" return "ok"
} }
sessionKey := fmt.Sprintf("cron-%s", job.ID) sessionKey := fmt.Sprintf("cron-%s-%d", job.ID, time.Now().UnixMilli())
// Call agent with the job message // Call agent with the job message
response, err := t.executor.ProcessDirectWithChannel( response, err := t.executor.ProcessDirectWithChannel(