Skip to main content

Module declared_body

Module declared_body 

Source
Expand description

Server-side execution of declared action bodies (no worker required). Server-side execution of declared action bodies.

An action whose deployed contract carries an [ActionBodyContract] is executed BY THE SERVER, with no connected worker: the dispatch is intercepted at the ActivityDispatcher seam before task-queue routing, the declared command runs through the worker SDK’s own executor (aion_worker::shell::ShellAction — argv-element substitution, no shell, process-group containment), and the result flows back through the engine’s normal completion path. The engine still schedules, records, and replays the activity exactly as if a worker had served it.

Actions with no declared body are delegated to the wrapped production dispatcher unchanged, so remote workers keep working exactly as before.

§The command is readable while it runs

The executing activity carries a live transcript seam (ActivityContext::with_transcript), so every line the command writes to stdout or stderr is published onto the server’s transcript sequencer AS IT ARRIVES — the same stream, envelope, and cursor reads an agent step’s transcript uses (see [super::declared_body_transcript]). The activity’s recorded result is untouched by this: it still carries the command’s complete output.

§The command can be stopped, by its bound and by its run

Two things end a server-executed command early, and both reach the same cancellation the worker path already acts on — SIGTERM → grace → SIGKILL across the whole process group, with the verdict withheld until the group has been proven gone.

The first is the attempt’s own deadline. A dispatch carrying an authored per-attempt timeout (#223) ends its command at that bound HERE, in the server, where the process is — see [run_bounded]. The engine’s own deadline stops the run WAITING and cannot reach a process, which is the right division of labour for a remote worker and no division at all for a body the server itself started. A dispatch that authored no bound is unbounded, exactly as before: the server adds no deadline of its own.

The second is the run being cancelled. Every executing attempt registers in [super::declared_body_cancel::DeclaredCommandAttempts] for exactly as long as its command runs, which is how the cancel path reaches an activity no worker holds and no heartbeat tracks. An attempt that cannot register is refused rather than run: a command a cancelled run could not stop is the defect the registration exists to prevent.

Structs§

DeclaredBodySource
Shared, install-once handle the dispatcher holds from construction and the boot path fills in once the engine exists.
DeclaredCommandDispatcher
The dispatcher decorator that executes declared bodies at the server.
DeclaredCommandExecutor
Executes a declared body at the server: the process-group-contained command, its transcript, its cancel-path registration, and the bound the dispatch authored. Owns no routing decision — a caller has already looked the body up — so it is the ONE implementation both the direct dispatch decorator above and the outbox row decorator (super::declared_body_outbox) run, and the two paths cannot execute a body differently.
DispatchingRun
Which run a declared-body lookup is being made for.
EngineDeclaredBodies
Reads declared bodies out of the engine’s live workflow catalog.

Enums§

DeclaredBodyLookup
What a declared-body lookup found for one (task_queue, action) address.

Traits§

DeclaredBodies
A reader over the deployed contracts’ declared action bodies.