SIGN IN SIGN UP

fix(server): keep source-context cleanup off the runtime sweep tick (#7541)

Source-context cleanup (MUL-6555) ran at the top of the 30s runtime sweep
tick, ahead of the stages that flip a dead runtime offline and reclaim its
orphaned tasks. Both cleanup stages call the object store, so a stalled or
throttled endpoint delayed runtime/task recovery: one round's work was
bounded by the number of due intents rather than the batch size, because
the loop counted successes, and the abandoned-capture path deleted objects
on the sweeper's root context with no per-object deadline.

Move both stages onto their own goroutine and ticker, bound each round with
a wall-clock budget, bound the intent loop by attempts, and give every
object delete a deadline. Failed deletes now record their retry backoff on
a context detached from the round budget, so a round cut short cannot leave
an intent claimable with no backoff and starve the rows behind it.

Cleanup cadence moves from 30s to 60s; nothing here is latency-critical
(intents settle for an hour, captures for 30 days).

Co-authored-by: J <bohan@devv.ai>
Co-authored-by: multica-agent <github@multica.ai>
B
Bohan Jiang committed
e5f976144b50b99efe4ceac63f11f86fa8e2a6c7
Parent: 8cc9a87
Committed by GitHub <noreply@github.com> on 8/25/2026, 9:57:41 AM