Skip to content

controller: replace Reconcile with explicit Suspend and Resume #534

Closed

Description

@yongruilin

Follow-up to #514 (comment).

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
  • internal/server/server.go: CreateTask, SuspendTask, ResumeTask, deleteTask

Activity

  1. janetkuo commented on Oct 29, 2026

    @janetkuo
    Member

    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.

  2. self-assigned this
    on Oct 29, 2026
  3. added a commit that references this issue on Oct 31, 2026
    f0228f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions