Skip to main content

Module executor

Module executor 

Source
Expand description

Node executor (plan Unit 11).

dispatch(node, ctx) is the single entry point the DAG runner in Unit 12 calls for each ready() node. Responsibilities:

  1. Emit node.started before any subprocess spawn.
  2. Dispatch to the node’s kind — bash, AI (command / prompt), or loop — and run the subprocess under a wall-clock deadline.
  3. For loops, iterate under a sentinel Scanner that watches for BLOCKED (always reserved) plus the user’s until token; session lifecycle follows the Unit 0 spike (--session-id first iteration, --resume thereafter, UUID not ULID).
  4. If the node carries a gate, run the platform-current hook script under a 60s deadline after a successful node terminates.
  5. Emit exactly one terminal event (node.completed or node.failed) and, when a gate ran, a gate.passed event between the node’s body completing and the terminal event.

The executor is the sole owner of node-level deadline handling — claude_proc::ClaudeProcess deliberately has no per-call timeout so that this module can decide, for example, that a loop’s wall-clock budget covers all iterations rather than each one independently.

Structs§

ExecutorContext
Inputs the executor needs that span every dispatch call on one run.

Enums§

DispatchError
Failure categories returned from dispatch itself (distinct from NodeOutcome::Failed, which is a recorded node failure). These are infrastructure errors that prevent the executor from even deciding the node’s outcome — event-log I/O, malformed pipe data leaking past validation, stream-parser crashes, etc.
NodeOutcome
Result of dispatching one node.

Constants§

DEFAULT_NODE_TIMEOUT
Default node wall-clock budget when a pipe node declares no timeout:. Picked to match the memory-locked 1800s default called out in the plan’s “Open questions deferred to implementation” block.
GATE_TIMEOUT
Gate hook deadline, per plan R12.

Functions§

dispatch
Dispatch one node end-to-end.