Repository navigation
Description
Problem
ax describe only tells you what a task is doing right now, and once a task is deleted it is just NotFound. RPC traces do not fill that gap: they are off by default, sampled at 10% when enabled, and cover gRPC calls only, not runner outcome callbacks or state diffs.
Agent Substrate solves this for actors with ate.actor.state_changed and ate.actor.crashed events, which go to stdout even without a collector. AX has nothing like that for tasks, so two things are missing when debugging:
- Why a task stopped: when a command finishes or fails, AX suspends the actor and logs nothing. To Substrate that looks just like
ax suspend, and once the task is deleted, its outcome and exit code are gone. - Task states Substrate does not see: Substrate only tracks the actor, not AX states like
Queued,Terminating, orDeleted.
Mapping ax.task.id onto Substrate events can live on the Substrate side once immutable actor labels in agent-substrate/substrate#3208 propagate to ate.actor.*. Even with that, Substrate still does not know command outcomes or AX-only phases.
Example
Say a task gets created, resumed, suspended, and resumed again, then gets stuck and someone deletes it. If you join ax.task.state_changed with Substrate's ate.actor.state_changed on ate.actor.uid, one query gives you the whole story:
18:24:14.168Z ax.task.state_changed task=t5-fail none -> Queued gen=1
18:24:14.358Z ax.task.state_changed task=t5-fail Queued -> Provisioned gen=2 ate.actor.uid=dbafc5d7...
18:24:14-28 ate.actor.state_changed actor=dbafc5d7... suspended -> resuming -> running -> suspending -> suspended -> resuming -> running
18:28:42.476Z ax.task.state_changed task=t5-fail Provisioned -> Terminating gen=9 ate.actor.uid=dbafc5d7...
18:28:42.49xZ ate.actor.state_changed actor=dbafc5d7... deleting -> deleted
18:28:42.710Z ax.task.state_changed task=t5-fail Terminating -> Deleted gen=10 ate.actor.uid=dbafc5d7...
You can tell right away that Substrate ran the actor fine without crashing, ax-server got no outcome back before the delete, and dbafc5d7... stays tied to this task ID even after the task is gone.
Proposal
Emit ax.task.state_changed (OTLP logs, with stdout JSON as a fallback) whenever a task write commits and changes phase, outcome, or ate.actor.uid:
- Only track AX-owned states (
Queued,Provisioned,Completed,Failed,Cancelled,Terminating,Deleted). Live actor states (Working,Suspended,Crashed) stay inate.actor.state_changed. - Use the commit time as the event timestamp, and include
ax.task.generation,ax.task.id,ate.actor.uid,ax.task.phase,ax.task.previous_phase,ax.task.outcome,ax.task.previous_outcome, andax.task.exit_code. - Emit after the write commits, best effort. Failed or no-op writes emit nothing, and telemetry errors do not break task writes.
Activity
JeffLuoo commentedon Nov 20, 2026
@mayawang as we discussed in the PR, create an issue for discussion
JeffLuoo commentedon Nov 23, 2026
also cc - @rakyll WDYT for having the state events for task like what we have for actor in substrate?