Repository navigation
Description
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:
-
Create a task and resume it, then suspend it with
ax suspend task demo-agent-01.ax get task demo-agent-01showsSuspended. -
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.
-
kubectl ate get actors -a cred-testnow shows the actor asACTOR_STATE_RUNNING, butax get task demo-agent-01still showsSuspendedwith no worker IP, and stays that way. -
ax sshrefuses 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, recordRunningwith the actor's worker address, and set theReadycondition with a reason likeResumedByRequest, so it's clear AX didn't do it; - if the actor is suspended but the task says
Running, recordSuspendedand 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:
- the state sync, in
CheckIdle: mastersingh24@7fc3445 - running the check periodically in ax-server: mastersingh24@379013f
Upstream it would make sense to run the sync for every task, not only the ones that suspend themselves.
Activity
rakyll commentedon Oct 22, 2026
A better alternative is that we always query the actor state from ATE API before formalizing the task state.
mayawang commentedon Oct 27, 2026
Fixed by #515, which reads actor state from Substrate on every get and list instead of keeping a copy in AX. Closing.