Portal Community

Execution Timeline


Parent:  ──[A]──[B]──[SubWorkflow]──(suspended)────────────────[C]──[D]──▶
                          │                                      ▲
                          │ Starts child                         │ Resumes with child output
                          ▼                                      │
Child:                 ──[X]──[Y]──[Z]──(complete)──────────────┘
  

The Suspension Mechanism

Synchronous mode uses the same HIL suspension mechanism as human-in-the-loop nodes. When the SubWorkflow executor calls _invoker.InvokeAsync() in sync mode:

  1. A new child execution is started with its own ExecutionId and ParentExecutionId linking to the parent
  2. The parent execution's SubWorkflowNode registers a resume callback keyed to the child ExecutionId
  3. The parent execution transitions to Suspended state — no more nodes run
  4. The child runs independently (may itself include HIL steps, loops, etc.)
  5. When the child reaches its terminal state (Completed or Failed), the engine fires the registered callback
  6. The parent resumes at the SubWorkflow node, which now returns with the child's output

Database-Backed Suspension

The suspension state is persisted to the database, so a server restart does not lose the pending parent. The parent execution record shows:

{
  "executionId": "exec-100",
  "status": "Suspended",
  "suspendedAt": "2026-05-25T10:00:00Z",
  "suspendReason": "AwaitingChildExecution",
  "pendingChildExecutionId": "exec-101"
}

Timeout in Sync Mode

If the child does not complete within the configured timeout (seconds), the engine:

  1. Cancels the child execution (transitions it to Cancelled)
  2. Fires the timeout port on the SubWorkflow node in the parent
  3. Resumes the parent with a timeout output: { timedOut: true, childExecutionId: "exec-101" }
Long-running children: If the child workflow includes HIL steps (human approvals, form submissions), the child may take hours or days. Set the timeout accordingly or use async mode if the parent does not need the result immediately.