Skip to content

bug(platform): a task run that ran out of memory with its retries spent is announced up to 30 minutes late #4717

Closed

Description

@yannickmonney

Summary

When a task agent run fails with resource_exhausted (its sandbox hit its memory limit), failAgentRunFromTurn holds the task.agent_retry job for 2, 10 or 30 minutes (services/platform/backend/domains/tasks/agent-runs.ts:712-732, schedule in services/platform/backend/core/tasks/task_auto_retry.ts:30-50). The hold is chosen from the failure code alone — it does not ask whether the retry budget has room. Verified on main at 73d03a9.

When the budget is already spent, no retry follows: the held job only wakes up to retire the run, and only then does retireAutoRetry (services/platform/backend/domains/tasks/run-failure-notice.ts:76-96) call announceAgentRunFailed. The people the run answers to learn of the final failure 2–30 minutes late, while every other final failure is announced in the failing transaction (agent-runs.ts:733-738). Meanwhile the run card already reads the failure as final, because failedRunRetryPending re-derives the budget (agent-runs.ts:761-779) — card and notification disagree for up to half an hour.

Suggested fix

Decide in the same transaction: compute resolveAutoRetryBudget(await loadTaskRetryHistory(tx, run.taskId)).retry (the walk failedRunRetryPending already uses) and set decideAfter only when a retry will follow; otherwise enqueue the job without startAfter (or retire and announce at once). Test: a resource_exhausted failure with the budget spent announces in the failing transaction.

Activity

  1. added
    priority: medium
    bug
    service: platform
    on Oct 10, 2026
  2. added
    agent-ready
    on Oct 29, 2026
  3. added a commit that references this issue on Oct 30, 2026
    a1da8b8
  4. added a commit that references this issue on Oct 30, 2026
    ed4c92c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions