On this page
Sommatic Docs
Open portal

Join / Merge

Consolidates multiple execution branches back into a single path.

View as Markdown
Open in
Flow control Available flow.join Version 1.0.0 Execution: sync

Collects the results of the items a flow.split fanned out and emits them as one array, once the split done signal and every item have arrived.

This operator implements the 'Fan-In' synchronization pattern. It is essential when a concurrent split (Fan-Out) needs to be gathered back for aggregated processing. It waits for upstream signals based on the configured mode before proceeding.

Modes:

  • Wait All: Blocks until ALL incoming branches have completed. Ideal for parallel processing where all results are needed.
  • Wait Any: Proceeds as soon as the FIRST branch completes. ideal for race conditions or redundancy checks.

Output: The result is an array containing the payloads from all joined branches: [result1, result2, ...].

How it works

  1. The engine buffers every arrival at a join node instead of running it. An arrival through a done port marks the gate ready and sets the expected count to total_items; any other arrival adds its payload to the list.
  2. When done has arrived and the list holds at least the expected count, the engine runs the worker once with the list as inputs and clears the gate.
  3. The worker returns { merged, count, mode } through out; merged keeps arrival order.
  4. With "Execute step" (no engine inputs), merged is built from the outputs of the executed nodes in the run graph, or [payload] when there are none.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-collect-orders",
  "label": "Collect orders",
  "operator_slug": "flow.join",
  "operator_version": "1.0.0",
  "config": {
    "mode": "wait_all",
    "timeout_ms": 0
  }
}

Configuration

mode string Optional

Strategy for synchronization.

Default: wait_all

Allowed values: wait_allwait_any

timeout_ms integer Optional

Maximum time to wait. 0 means infinite wait.

Default: 0

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

mode
Only echoed in the output: wait_any behaves like wait_all.
timeout_ms
Ignored: the join never times out.

Output ports

out default

All items arrived after the split done signal.

Data
{
  "merged": [
    {
      "order_id": "ord_1",
      "status": "synced"
    },
    {
      "order_id": "ord_2",
      "status": "synced"
    }
  ],
  "count": 2,
  "mode": "wait_all"
}
timeout

Never emitted: timeout_ms is ignored.

error

Never emitted by the worker.

In expressions

What a later node can read from this node's output with $("Join / Merge").item.json.<path> (write your node's label instead of Join / Merge). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("Join / Merge").item.json.payloadarrayThe worker does not return it: reads as undefined —
$("Join / Merge").item.json.mergedarrayNot suggested by the editor= […] (2)—
$("Join / Merge").item.json.countnumberNot suggested by the editor= 2—
$("Join / Merge").item.json.modestringNot suggested by the editor= "wait_all"—

— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Input contract

payload object Optional

Output contract

payload array<object> Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "flow.join",
  "name": "Join / Merge",
  "category": "flow",
  "version": "1.0.0",
  "description": "Consolidates multiple execution branches back into a single path.\n\n  This operator implements the 'Fan-In' synchronization pattern. It is essential when a concurrent split (Fan-Out) needs to be gathered back for aggregated processing. It waits for upstream signals based on the configured mode before proceeding.\n\n  **Modes:**\n  - **Wait All:** Blocks until ALL incoming branches have completed. Ideal for parallel processing where all results are needed.\n  - **Wait Any:** Proceeds as soon as the FIRST branch completes. ideal for race conditions or redundancy checks.\n\n  **Output:**\n  The result is an array containing the payloads from all joined branches: `[result1, result2, ...]`.",
  "capabilities": [
    "fan-in",
    "aggregation",
    "sync"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "mode": {
        "type": "string",
        "enum": [
          "wait_all",
          "wait_any"
        ],
        "default": "wait_all",
        "title": "Join Mode",
        "description": "Strategy for synchronization."
      },
      "timeout_ms": {
        "type": "integer",
        "title": "Timeout (ms)",
        "description": "Maximum time to wait. 0 means infinite wait.",
        "default": 0
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "description": "Receives multiple upstream payloads (handled by engine).",
    "properties": {
      "payload": {
        "type": "object"
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "description": "Array of results from the joined branches.",
    "properties": {
      "payload": {
        "type": "array",
        "items": {
          "type": "object"
        }
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Merged",
      "is_default": true,
      "description": "Active when join condition is met."
    },
    {
      "port_id": "timeout",
      "label": "Timeout",
      "description": "Active if the join waits longer than the timeout."
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Active on internal failure"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "merge",
    "aggregate",
    "synchronize",
    "fan-in"
  ],
  "is_stateful": true,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
sync
Stateful
Yes
Retries (retryOnFail)
No
Capabilities
fan-inaggregationsync
Tags
mergeaggregatesynchronizefan-in

Notes and limits

  • Without an edge from a flow.split done port into the join, the join never runs: arrivals from ordinary parallel branches are buffered forever, nothing after the join runs, and the run still completes.
  • If an item branch ends elsewhere (an error port, a false port without an edge) or the split uses batch_size > 1, the expected count is never reached and the join does not run.
  • An empty array in the split sends only done; the join then runs with merged: [] and count: 0.
  • Join gates live in memory for the current run only.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs