autonomy: avoid immediate redispatch of running tasks after restart until pending timeout

This commit is contained in:
DBT
2026-03-01 14:45:43 +00:00
parent 5ac4ca6191
commit 8a94600b1e

View File

@@ -350,6 +350,11 @@ func (e *Engine) tick() {
continue
}
}
// Keep running tasks intact across ticks/restarts until pending timeout,
// so a gateway restart won't immediately redispatch from scratch.
if !st.LastRunAt.IsZero() && now.Sub(st.LastRunAt) <= time.Duration(e.opts.MaxPendingDurationSec)*time.Second {
continue
}
}
if st.Status == "blocked" {
e.releaseLocksLocked(st.ID)