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
controller: replace Reconcile with explicit Suspend and Resume #534
Server handlers tell TaskReconciler what to do by setting task.Status.Phase before calling Reconcile: Suspended (or empty) means suspend, and Running means resume. As #515 noted, this mixes intent with observed state.
The phase also does two other jobs today, and both need to become explicit:
A successful call clears a stored Pending or Failed only because it ends on a phase the store doesn't keep.
A failed task is marked Failed only if its phase isn't already Pending.
Proposal
Replace Reconcile with Suspend(ctx, task, ws) error and Resume(ctx, task, ws) error. Both first make sure the atespace, template and actor exist, as Reconcile does now.
Rename ReconcileDelete to Delete.
Handlers stop setting the phase to pass the action. CreateTask calls Suspend, so starting suspended is an explicit step.
On success, handlers clear the phase so reads take it from the actor. On failure, IsTransientError alone decides between Pending and Failed.
The reconciler records only what AX stores: the task ID, WorkspaceReady, and Pending or Failed with a Ready reason on failure. It stops writing the actor name, worker IP and Running/Suspended, which the server discards.
Out of scope: skipping the atespace, template and actor checks on every call, and renaming TaskReconciler.
Affected code
internal/controller/reconciler.go and reconciler_test.go
Thanks for filing this @yongruilin. The breakdown looks great, please go ahead and take it! Happy to review once #532 merges and you have the PR up.
One thing to watch out for on failure handling. CreateTask needs Pending / Failed persisted when initial provisioning fails, but if SuspendTask fails on an already-running task, we probably shouldn't persist Pending or Failed in the store, since IsAXPhase would cause setActorStatus to mask the live running actor state on Substrate.
Activity
janetkuo commentedon Oct 29, 2026
Thanks for filing this @yongruilin. The breakdown looks great, please go ahead and take it! Happy to review once #532 merges and you have the PR up.
One thing to watch out for on failure handling. CreateTask needs Pending / Failed persisted when initial provisioning fails, but if SuspendTask fails on an already-running task, we probably shouldn't persist Pending or Failed in the store, since IsAXPhase would cause setActorStatus to mask the live running actor state on Substrate.
controller: replace Reconcile with explicit Suspend and Resume (googl…