Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/gateway_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ func makeCronJobHandler(sched *scheduler.Scheduler, msgBus *bus.MessageBus, cfg
// Reset session before each cron run to prevent tool errors from previous
// runs from polluting the context and blocking future executions (#294).
// Save() persists the empty session to DB so stale data won't reload after restart.
// Stateless jobs skip this — they intentionally carry no session history.
if !job.Stateless {
// Always reset cron sessions to prevent message accumulation across runs.
// Stateless jobs especially need this — the agent loop persists messages
// to the session regardless of the stateless flag, so without a reset
// the session grows indefinitely.
{
sessionMgr.Reset(cronCtx, sessionKey)
sessionMgr.Save(cronCtx, sessionKey)
}
Expand Down