Compensate Saga
Triggers the compensation process for a distributed transaction (Saga).
Experimental. Meant to trigger the rollback of a saga. In the current runtime it always leaves through error with logger.warn is not a function; even then, the __signal: "COMPENSATE" it would return is not read by the engine, so no undo step runs.
When a failure occurs in a long-running transaction, this operator instructs the engine to "rollback" by executing the registered compensation steps for all previously successful activities in reverse order.
Behavior:
- Identifies the active Saga Scope.
- Retrieves the 'undo' operations for completed steps.
- Executes them stack-wise (LIFO).
Use Cases:
- Rolling back a payment if inventory reservation fails.
- Cancelling a hotel booking if the flight is unavailable.
How it works
- Merges the input item with the resolved config (config wins).
- Uses
reason(defaultManual Trigger) andsaga_idfrom the config or the input item. - With or without
saga_id, callslogger.warn(), which throws; the worker catches it and leaves througherror. The steps below are not reached today. - Without
saga_id: would leave througherrorwithNo Active Saga. - With
saga_id: would return{ __signal: "COMPENSATE", saga_id, reason, port: "compensated", compensated: true }, which the engine passes on as plain output.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-compensate-order",
"label": "Compensate order saga",
"operator_slug": "saga.compensate",
"operator_version": "1.0.0",
"config": {
"saga_id": "{{ $json.saga_id }}",
"reason": "Payment declined"
}
}{
"ok": false,
"port": "error",
"data": {
"port": "error",
"error": "logger.warn is not a function"
}
}Configuration
This node has no configuration fields.
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.
-
saga_id - Not in the config schema (only in the input contract), but read from the node config or, when unset there, from the input item:
saga_id,reason.
Output ports
compensated default Not reached in the current runtime: the logger.warn() call fails first. Shown with the shape the code builds.
{
"__signal": "COMPENSATE",
"saga_id": "ce78b34b-0bf5-4372-89b0-ae0eb6adddc1",
"reason": "Payment declined",
"port": "compensated",
"compensated": true
}error Every run today. The output is the whole returned object, { port, error }.
{
"port": "error",
"error": "logger.warn is not a function"
}In expressions
What a later node can read from this node's output with $("Compensate Saga").item.json.<path> (write your node's label instead of Compensate Saga). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through compensated, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Compensate Saga").item.json.compensatedTrue if compensation workflow initiated. | ||
$("Compensate Saga").item.json.__signal | — | |
$("Compensate Saga").item.json.saga_id | — | |
$("Compensate Saga").item.json.reason | — | |
$("Compensate Saga").item.json.port | — |
— 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).
Errors
| Message | Port | Cause and fix |
|---|---|---|
logger.warn is not a function | error | The worker calls logger.warn(), which the runtime logger does not provide. It happens on every run; there is no configuration that avoids it. |
No Active Saga | error | Not reached today. It would mean that saga_id is set neither on the node nor in the input item; the fallback to an active saga in the context never finds one. |
Input contract
-
reasonstring Optional -
Reason for compensation trigger.
-
saga_idstring Optional -
Specific Saga ID (optional, defaults to context).
Output contract
-
compensatedboolean Optional -
True if compensation workflow initiated.
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": "saga.compensate",
"name": "Compensate Saga",
"category": "ops",
"version": "1.0.0",
"description": "Triggers the compensation process for a distributed transaction (Saga).\n\n When a failure occurs in a long-running transaction, this operator instructs the engine to \"rollback\" by executing the registered compensation steps for all previously successful activities in reverse order.\n\n **Behavior:**\n - Identifies the active Saga Scope.\n - Retrieves the 'undo' operations for completed steps.\n - Executes them stack-wise (LIFO).\n\n **Use Cases:**\n - Rolling back a payment if inventory reservation fails.\n - Cancelling a hotel booking if the flight is unavailable.",
"capabilities": [
"saga",
"transaction",
"rollback",
"ops"
],
"config_schema": {
"type": "object",
"properties": {
"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",
"properties": {
"reason": {
"type": "string",
"description": "Reason for compensation trigger."
},
"saga_id": {
"type": "string",
"description": "Specific Saga ID (optional, defaults to context)."
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"compensated": {
"type": "boolean",
"description": "True if compensation workflow initiated."
}
}
},
"ports": [
{
"port_id": "compensated",
"label": "Compensated",
"is_default": true,
"description": "Compensation process started."
},
{
"port_id": "error",
"label": "Error",
"description": "Failed to trigger compensation."
}
],
"execution_mode": "sync",
"tags": [
"saga",
"rollback",
"transaction"
],
"is_stateful": true,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"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
}
}
}
}
}{
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Reason for compensation trigger."
},
"saga_id": {
"type": "string",
"description": "Specific Saga ID (optional, defaults to context)."
}
}
}{
"type": "object",
"properties": {
"compensated": {
"type": "boolean",
"description": "True if compensation workflow initiated."
}
}
}[
{
"port_id": "compensated",
"label": "Compensated",
"is_default": true,
"description": "Compensation process started."
},
{
"port_id": "error",
"label": "Error",
"description": "Failed to trigger compensation."
}
]Execution
- Execution
sync- Stateful
- Yes
- Retries (
retryOnFail) - No
- Capabilities
sagatransactionrollbackops- Tags
sagarollbacktransaction
Notes and limits
- The worker calls
logger.warn(), which the runtime logger does not provide (it offersinfo,warning,error,logandsuccess). The call throws on every run. - Missing for a working compensation: the engine does not read
__signal, keeps no saga history and has no step that runsundologic. Model rollbacks today withflow.tryand explicit compensation nodes. - Leaving through
errordoes not fail the run: the engine follows the edges wired toerror, and if there are none the branch simply ends. - The
executionsettings (retryOnFail,maxTries,waitBetweenTries,continueOnFail,timeout_ms) are accepted, but neither this worker nor the engine applies them.
Reviewed against the orchestrator code · 31e874b · 2026-11-26