workflow.call, workflow.approve, workflow.handoff and message.send on the durable engine #2044

Closed
opened 2026-11-17 07:29:40 +00:00 by sam · 1 comment
Owner

Child of #2037. Plan: workflow vocabulary on the durable engine, one requirement per child.

workflow.call starts a child run (keyed by the step path) and, with wait: true, waits on it by signal and publishes its outputs; workflow.approve and workflow.handoff hand a run to the next workflow; message.send delivers an authored message.

Done when: each type's corpus documents run on fakes, and a call survives a restart while it waits.

Child of #2037. Plan: workflow vocabulary on the durable engine, one requirement per child. `workflow.call` starts a child run (keyed by the step path) and, with `wait: true`, waits on it by signal and publishes its outputs; `workflow.approve` and `workflow.handoff` hand a run to the next workflow; `message.send` delivers an authored message. Done when: each type's corpus documents run on fakes, and a call survives a restart while it waits.
sam added the featurehigh labels 2026-11-17 07:29:40 +00:00
sam added a new dependency 2026-11-17 07:29:56 +00:00
Author
Owner

Built in 5d8c9303e and 4b5c60330 (migration 00045: parent_run_id, parent_signal, call_depth on runs).

  • workflow.call starts a child run with the start key call:<run>:<step>, so a replay or restart never starts a second child. With wait: true the parent waits through the engine's existing wait, holding no worker. The child's Finish or Cancel signals the parent in the same transaction, so a crash can't strand a waiting parent. Ported from the old workflow_call.go: the settings, the inputs.<name> references, the depth limit of 5, the rule that outputs need wait, and a parked child failing its caller. A child that ends waiting for approval does not signal, so its caller keeps waiting.
  • workflow.handoff starts the target on the same input (key handoff:<run>:<step>) and ends the run succeeded. workflow.approve records and delivers the plan, then ends the run waiting_approval. message.send sends an authored message through the deliveries module. Each records instead of acting in a dry run.
  • Retrying a parked run detaches the children of the calls it discards.

Verified: TestDocumentStepsRun gained cases for call (with and without wait, restart, crash then restart, parked child, dry run), handoff, approve and message. With a random child key, the crash-then-restart case fails with "started 2 runs, want 1". task check passed on the merged tree. The call SQL itself (child start, parent signal, detach) has not been run against a database.

Follow-ups filed: #2085 (message.send needs a connector that declares chat_message) and #2086 (cancelling a parent leaves its child running). Still for #2037: workflow outputs and checking call result references at save, refusing call cycles at save, and resuming a waiting_approval run into its then workflow.

Built in 5d8c9303e and 4b5c60330 (migration 00045: `parent_run_id`, `parent_signal`, `call_depth` on runs). - `workflow.call` starts a child run with the start key `call:<run>:<step>`, so a replay or restart never starts a second child. With `wait: true` the parent waits through the engine's existing wait, holding no worker. The child's `Finish` or `Cancel` signals the parent in the same transaction, so a crash can't strand a waiting parent. Ported from the old workflow_call.go: the settings, the `inputs.<name>` references, the depth limit of 5, the rule that outputs need `wait`, and a parked child failing its caller. A child that ends waiting for approval does not signal, so its caller keeps waiting. - `workflow.handoff` starts the target on the same input (key `handoff:<run>:<step>`) and ends the run succeeded. `workflow.approve` records and delivers the plan, then ends the run `waiting_approval`. `message.send` sends an authored message through the deliveries module. Each records instead of acting in a dry run. - Retrying a parked run detaches the children of the calls it discards. Verified: `TestDocumentStepsRun` gained cases for call (with and without wait, restart, crash then restart, parked child, dry run), handoff, approve and message. With a random child key, the crash-then-restart case fails with "started 2 runs, want 1". `task check` passed on the merged tree. The call SQL itself (child start, parent signal, detach) has not been run against a database. Follow-ups filed: #2085 (`message.send` needs a connector that declares `chat_message`) and #2086 (cancelling a parent leaves its child running). Still for #2037: workflow outputs and checking call result references at save, refusing call cycles at save, and resuming a `waiting_approval` run into its `then` workflow.
sam closed this issue 2026-11-21 04:02:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#2044