Skip to content

AX keeps saying a task is Suspended after a request wakes it #502

Closed

Description

@mastersingh24

What happens

When a request arrives for a suspended task, Agent Substrate's router wakes the task's actor so it can answer. AX doesn't find out. The task keeps running, but AX still records it as Suspended, with no worker address. Anything that trusts AX's view then gets it wrong: ax ssh refuses to connect, and dashboards built on AX show the task as asleep while it runs and holds worker capacity.

The same thing happens the other way round. If the actor is suspended outside AX, for example with kubectl ate suspend actor, AX keeps showing the task as Running.

Example

We ran into this before we patched our fork. To reproduce it:

  1. Create a task and resume it, then suspend it with ax suspend task demo-agent-01. ax get task demo-agent-01 shows Suspended.

  2. Send any request for it through the router, from a pod in the cluster:

    $ curl -s -H "ate-target-actor: cred-test/demo-agent-01" \
        http://atenet-router.ate-system.svc.cluster.local/healthz

    The router wakes the actor and the runner answers.

  3. kubectl ate get actors -a cred-test now shows the actor as ACTOR_STATE_RUNNING, but ax get task demo-agent-01 still shows Suspended with no worker IP, and stays that way.

  4. ax ssh refuses the task:

    $ ax ssh demo-agent-01 -- uname -a
    Error: task "demo-agent-01" is in phase "Suspended" (must be Running to ssh)

AX only updates the phase when it suspends or resumes a task itself, so a wake by the router is invisible to it until something else reconciles the task.

Proposed solution

Have ax-server check the actor's real state from time to time and bring the task's phase in line with it. GetActor on Substrate's control API is safe for this, because it never wakes an actor. For a task recorded as Running or Suspended:

  • if the actor is running but the task says Suspended, record Running with the actor's worker address, and set the Ready condition with a reason like ResumedByRequest, so it's clear AX didn't do it;
  • if the actor is suspended but the task says Running, record Suspended and clear the worker address;
  • keep the worker address current while the task runs, since a woken actor can land on a different worker;
  • leave other states (resuming, crashed, reverting) alone until the next pass.

On our fork this runs as part of a periodic check in ax-server (every 30 seconds) that we added for automatic suspension (#420), so a router wake shows up in AX within one interval:

Upstream it would make sense to run the sync for every task, not only the ones that suspend themselves.

Activity

  1. rakyll commented on Oct 22, 2026

    @rakyll
    Member

    A better alternative is that we always query the actor state from ATE API before formalizing the task state.

  2. self-assigned this
    on Oct 23, 2026
  3. mayawang commented on Oct 27, 2026

    @mayawang
    Collaborator

    Fixed by #515, which reads actor state from Substrate on every get and list instead of keeping a copy in AX. Closing.

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