You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Task is marked Failed permanently when Substrate returns ResourceExhausted (no free workers) instead of staying Pending and retrying #367
When Substrate has no free worker for a new actor, EnsureActor/resume returns ResourceExhausted: no free workers available and the controller marks the Task phase: Failed with Ready=False, reason=ActorResumeFailed. The Task is never reconciled again, so it stays Failed even after workers free up. For any workload that submits more Tasks than the WorkerPool has replicas, every Task beyond the pool size is lost instead of queued.
Combined with #346 (a finished command does not release its worker) this shows up quickly: after N completed Tasks in a pool of N workers, all further Tasks fail on creation.
AX d8ed0fe, Agent Substrate on a single-node kind cluster, gVisor WorkerPool with 4 replicas.
Reproduction
Create a WorkerPool with replicas: 4 and apply 6 Tasks that run a long-lived command (e.g. sleep 3600) with the same image.
ax get tasks: 4 are Running, 2 are Failed.
ax describe task on a failed one:
Conditions:
TYPE STATUS REASON MESSAGE
GatewayReady True PoliciesApplied Network policies active
Ready False ActorResumeFailed resuming actor default/task-5: rpc error: code = ResourceExhausted desc = no free workers available
Delete two of the running Tasks (or scale the pool to 6). The failed Tasks stay Failed; no reconcile is triggered.
ResourceExhausted is a transient scheduling condition, not a Task failure. The Task should stay in Pending (e.g. Ready=False, reason=WaitingForWorker) and be retried with backoff until a worker is available or a configurable deadline passes.
Suggested fix
In internal/controller/reconciler.go, distinguish codes.ResourceExhausted from other errors in the EnsureActor/resume path: set a Pending-style condition instead of phase: Failed, and re-publish the reconcile event with a delay (or let the worker loop requeue it). A --schedule-timeout flag could turn a long wait into a real failure.
Worth noting this isn't just a pool-exhaustion edge case. A fresh AX + Substrate install has zero WorkerPools, so this is literally the first thing you hit following the README's 3-step quickstart as written. None of the docs mention a WorkerPool needs to exist before ax apply -f examples/task.yaml will work. A docs callout might be a cheap near-term fix alongside the retry behavior you're proposing.
I’m working on this. Current main uses direct reconciliation with resource locks rather than the former event queue, so the planned fix is to persist worker exhaustion as Pending / WaitingForWorker and retry it in ax-server with capped backoff, re-reading task state under its resource lock. Pending tasks should survive server restarts, and suspend/delete must prevent later activation.
Validation will include regression tests for transient versus permanent errors and lifecycle cancellation, plus an end-to-end capacity-exhaustion/recovery test against Substrate. I also plan to attach a short terminal recording of the reproducible test for review. A configurable scheduling deadline will remain a separate follow-up to keep this change focused.
This is working as intended at this point. We don't want to introduce queuing in AX. Substrate eventually will handle queuing and AX will leverage it. We don't want to build anything AX that is not forward compatible with Substrate.
Activity
sharadregoti commentedon Sep 22, 2026
Worth noting this isn't just a pool-exhaustion edge case. A fresh AX + Substrate install has zero WorkerPools, so this is literally the first thing you hit following the README's 3-step quickstart as written. None of the docs mention a WorkerPool needs to exist before
ax apply -f examples/task.yamlwill work. A docs callout might be a cheap near-term fix alongside the retry behavior you're proposing.Remove antigravity from ax.yaml (google#367)
Remove experimental Antigravity planner integration (google#370)
erain commentedon Oct 13, 2026
I’m working on this. Current main uses direct reconciliation with resource locks rather than the former event queue, so the planned fix is to persist worker exhaustion as Pending / WaitingForWorker and retry it in ax-server with capped backoff, re-reading task state under its resource lock. Pending tasks should survive server restarts, and suspend/delete must prevent later activation.
Validation will include regression tests for transient versus permanent errors and lifecycle cancellation, plus an end-to-end capacity-exhaustion/recovery test against Substrate. I also plan to attach a short terminal recording of the reproducible test for review. A configurable scheduling deadline will remain a separate follow-up to keep this change focused.
rakyll commentedon Oct 14, 2026
This is working as intended at this point. We don't want to introduce queuing in AX. Substrate eventually will handle queuing and AX will leverage it. We don't want to build anything AX that is not forward compatible with Substrate.