Repository navigation
Description
Split from #3977 ("OOM deaths are classified and backed off" and "Person-started retries are
capped"), re-checked against main at b2560c2 (TALE-47). Line references are against that
commit.
What happens
Since #4633 and #4643, a run whose sandbox ran out of memory fails as resource_exhausted. Its
retry waits 2, then 10, then 30 minutes (RESOURCE_EXHAUSTED_RETRY_DELAYS_MS,
services/platform/backend/core/tasks/task_auto_retry.ts:37). The wait is chosen from the failed
run's attempt (services/platform/backend/domains/tasks/agent-runs.ts:926). But the retry budget
never ends such a chain when each attempt works for a while first:
- The budget resets on any long attempt.
resolveAutoRetryBudgetends the streak at any
failure that ran for 15 minutes or more (if (executedMs(row) >= AUTO_RETRY_PROGRESS_MS) break;,
task_auto_retry.ts:318), whatever its failure code. The retry then shows attempt 1 (:331).
So the next out-of-memory wait is 10 minutes again and never reaches 30. - A person's runs are never counted. The per-task hourly breaker
(AUTOMATED_STARTS_PER_TASK_PER_HOUR = 3,
services/platform/backend/domains/tasks/delegated-start.ts:160) counts only runs that carry
started_via(:279). The retry job admits the retries of a person's run without that check
(services/platform/backend/jobs/task-list.ts:457-459). A test pins this
(task-list.agent-retry.test.ts:690), and the docs say so
(docs/en/platform/projects/task-automation.md:133). - Automated chains pass the breaker too. Each cycle is at least 15 minutes of work plus a
10-minute wait, so no more than two counted starts fall within any hour.
A task whose work does not fit its sandbox's memory (say, a build OOM-killed after 20 minutes) is
therefore retried about every half hour. That goes on until a person moves, reassigns or cancels
the task, and every attempt pays for the model again. In #3977's incident, one task ran 8 times
and another spent 554 run-minutes over 7 runs.
Expected
- A
resource_exhaustedfailure counts toward the three-retry budget however long it ran.- Once three retries in a row have also run out of memory, the chain ends with the existing
notice (tasks.agentRun.failure.out_of_memory). - The wait grows from 2 to 10 to 30 minutes across them.
- Unit tests go in
task_auto_retry.test.ts, plus an integration case for settle → held retry
→ retry.
- Once three retries in a row have also run out of memory, the chain ends with the existing
- The automation lane resets the same way (
services/platform/backend/core/automations/agent_retry.ts:268).
Apply the same rule there, or say on this issue why not. feat(platform): hold an automation agent node that ran out of memory for 10 and 30 minutes too #4723 covers that lane's wait. - Decide whether a person's run's automatic retries also count against a per-task cap, as Bug: concurrent runs of one agent pile into one sandbox session and can exhaust the host #3977
asked, and record the decision here. If they do, the test at:690and the docs at:133
change with it. - The user docs name the out-of-memory case.
task-automation.md:137says retries "start right
away except in the cases below". Neither those cases nor When the agent can't finish
(:151) mention running out of memory.
Related
- bug(platform): a task run that ran out of memory with its retries spent is announced up to 30 minutes late #4717: the final failure is announced late after the wait.
- feat(platform): hold an automation agent node that ran out of memory for 10 and 30 minutes too #4723: the automation node's wait.
Activity
test(platform): prove on real Postgres that out-of-memory retries end
test(platform): prove on real Postgres that out-of-memory retries end
tale-code-bot commentedon Oct 30, 2026
Decisions for this issue, from board task TALE-244. The change is on branch
fix/oom-retry-budget(head214cc86b85476b23178d95bbb1153099900fdb63, ontrainat3024254a0df1b2c6c4a6149bd0845e0d8402f430) and waits for review. Once landed, it reachesmainwith the next fix train.An out-of-memory failure counts however long it ran. There is now one rule,
refreshesRetryBudgetinservices/platform/backend/core/tasks/task_auto_retry.ts: an attempt that worked 15 minutes or more refreshes the retry budget, unless it failedresource_exhausted.resolveAutoRetryBudgetuses it, and so does the attempt a free credential rotation keeps. A run that keeps running out of memory is now retried as attempts 1, 2 and 3, after waits of 2, 10 and 30 minutes. When the third retry runs out of memory too, the run fails for good with the existing out-of-memory notice.The automation lane follows the same rule.
planWorkflowAgentRetryinservices/platform/backend/core/automations/agent_retry.tscalls the samerefreshesRetryBudget, so an agent node that keeps running out of memory stops after its third re-kick. That lane's wait is unchanged and stays with #4723.Decision: a person's run's automatic retries count against the per-task cap. The hourly breaker (
AUTOMATED_STARTS_PER_TASK_PER_HOUR = 3) now counts every automatic retry, whoever started the run it continues: it counts each run row withstarted_viaor theauto_retrytrigger. The retry job admits every retry throughadmitAutomatedStart, and a refused retry ends that run's retries with the failure notice. A person's own Start (Start agent, a mention, a move to In progress) is still never counted or refused.Why:
The tests and docs changed with the decision:
task-list.agent-retry.test.ts: the test at:690now pins that the retry is counted, and a new test pins its refusal once the hour holds three automated starts.TASK-R12is rewritten, and the newTASK-R84is the out-of-memory rule.task-automation.md,triggers.mdandexecution-logs.md.The user docs name the out-of-memory case.
task-automation.mdnow gives the 2, 10 and 30 minute waits and says that an out-of-memory failure counts however long the run worked. When the agent can't finish gains a row for a sandbox that ran out of memory.Proof
[TASK-R84]and[TASK-R12], in:task_auto_retry.test.tsagent_retry.test.tsdelegated-start.budget.test.tstask-list.agent-retry.test.tscheckOutOfMemoryRetryBudgetinbackend:integration, runs settle → held retry (2, 10, 30 min) → retry three times, then the final failure. The worker has no Postgres, so that lane and the two lanes changed with the breaker were typechecked but not run there. The fix train's pull request runs them.test(platform): show the breaker counts each out-of-memory retry
test(platform): prove on real Postgres that out-of-memory retries end
test(platform): show the breaker counts each out-of-memory retry
fix(platform): end the retries of a run that keeps running out of memory