spec/action-lifecycle.yaml.
States
Invariant.
rejected and any cancelled reached from a pre-execution state guarantee no side effects. failed, preempted, and any terminal state reached through cancelling may leave partial effects, reported via aborted_at_progress.
Requirements
- Every transition MUST be one listed in the transition table. The world MUST report every transition after admission exactly once: a transition an
action.cancelcauses in its result, every other one as anaction.statusnotification. Terminal states arerejected,completed,failed,preempted,cancelled. Every action reaches exactly one logical terminal state.[AWP-LIF-001] - Admission acknowledgement. The
action.submitresult MUST report the post-validation state —pending_approval,queued, oraccepted— together withreceived_ts_mono_ns, the session-clock time the world received the submission, andts_mono_ns, the time of the reported transition; or it MUST return a JSON-RPC error, in which case the submission isrejectedand no action is created (AWP-ACT-010). An idempotent resubmission reports the action’s current state instead (AWP-ACT-001). In streaming mode the result MUST arrive within 500 ms of receipt; in lockstep, before the world processes its nextworld.tick. Waiting for approval or for a queue slot does not count against this bound.[AWP-LIF-002] - During
executing, worlds SHOULD send progress updates (progress∈ [0,1]) forduration: extendedtypes at ≥1 Hz in streaming mode and at least once per tick in lockstep.[AWP-LIF-003] failed,rejected, andcancelledstatuses MUST carry a machine-readablereasonfrom the status reason registry and MAY carry human-readabledetail.[AWP-LIF-004]- Cancellation.
action.cancelon a pre-execution action transitions it directly tocancelled(reasoncancelled_by_agent). On anexecutingaction the world MUST entercancelling, complete its safe abort, then reportcancelledwithaborted_at_progress.cancellingis reported as a status like any other state.[AWP-LIF-005] - Replay.
action.statusnotifications after the agent’slast_status_seqMUST be replayed onsession.resumeaccording to the delivery contract.[AWP-LIF-006] - Streaming duration.
duration: streamingactions (command channels) have no self-completion: they remainexecutingwhile their stream is live and terminate only viacancelling → cancelled,failed(reasonwatchdog,envelope,deadline_exceeded,e_stop,connection_lost), orpreempted(AWP-CMD-004).[AWP-LIF-007] - Precedence. Two terminating causes coincide when the second arises before the world has emitted the terminal status the first would produce — for an
executingaction, at any point duringcancelling. The world MUST then apply the first that applies in this order: e-stop → safe-state entry →world.reset/world.restore→session.close, window expiry, or transfer →action.cancel→ deadline expiry → validity expiry or basis age (AWP-SAF-013) → approval decision → preemption by a newer submission. Thereasonreported is the cause that won. A cause that wins while the action iscancellingends it as the terminal rules give forcancelling: an e-stop or safe-state entry ends itfailed; any other cause leaves the abort in progress.[AWP-LIF-008] - Transition vs delivery. A transition happens once, in the world, at a single
ts_mono_ns. Itsaction.statusnotification MAY be delivered more than once (after reconnection, AWP-CTL-008). Receivers MUST deduplicate onstatus_seq, which is unique within the session, and MUST NOT treat a redelivered terminal status as a second terminal transition.[AWP-LIF-009] - Abort bound. An action type MAY declare
max_abort_ms; when it does, the world MUST report the terminal status of anycancellingaction of that type withinmax_abort_msof enteringcancelling. A safe abort that cannot complete, or that has not completed whenmax_abort_mselapses, endsfailedwith reasonabort_failed, and the world applies its declared safe state to the embodiment (AWP-SAF-004).action.cancelor a status pull naming anaction_idthe world has never seen, or has discarded after its retention period (AWP-ACT-006), fails withAWP_ACTION_UNKNOWN.[AWP-LIF-010]
Deadline origin
deadline_ms is measured from the world’s receipt of action.submit (received_ts_mono_ns in the admission acknowledgement) and spans approval waiting, queue waiting, and execution. Expiry in a pre-execution state → rejected, reason deadline_exceeded (no side effects). Expiry during executing → failed, reason deadline_exceeded, after the type’s safe-abort behavior (AWP-ACT-004). In lockstep, deadlines are advisory and MAY be ignored.
Terminal rules
Queued actions leave the queue in submission order when the group frees; each is re-checked against grants, envelopes,
valid_until_ns, and max_basis_age_ms at the moment it becomes accepted, and MAY be rejected then.