Skip to content
Tracon

WorkflowResponseMode

Namespace Tracon · Assembly Tracon.Abstractions.dll

How a workflow treats more than one answer to the same pending human request.

[JsonConverter(typeof(JsonStringEnumConverter<WorkflowResponseMode>))]
public enum WorkflowResponseMode

Branch = 0

Every answer opens a new run that continues from the request, so a second answer to the same request opens a second branch. The default.

SingleAnswer = 1

One answer per request. Repeating the same answer follows the run the first one started instead of opening another; a different answer is refused with 409 Conflict.

Two answers are the same when their approved, text and data are the same; the checkpoint and definition version they name do not count. An answer whose run stopped before the workflow received it (the connection dropped, the run failed or was cancelled) can be given again, and it starts a new run. A queued answer whose job is still waiting or running is followed instead: the job’s recovery owns that work.

A run its process left running locks the request. When a process stops in the middle of a streamed answer’s run, the run row stays RunStatus.Running, and a repeat of the answer follows a run that never moves. Only run reconciliation (RunReconciliationOptions.Enabled, Tracon:RunReconciliation:Enabled, off by default) closes such a run: it closes a RunStatus.Running run whose heartbeat stopped. Turn it on where a single-answer workflow must be answerable again after a crash.

A queued answer does not depend on reconciliation, which reads no RunStatus.Queued run. Once its job is written, the job continues or closes the run. When the process stopped after the answer was recorded but before its job was written, a repeat of the same answer writes the job and follows the run; two repeats at the same time write it once.

The mode is chosen per workflow: WorkflowDefinition.ResponseMode for a stored definition, WorkflowRegistrationOptions.ResponseMode for a workflow defined in code. A run that waits keeps the mode of the definition version it recorded, so an edit made while it waits does not change how it is answered.

Every answer that starts a run is written to the audit trail before the run starts, whatever the mode, and refused when it cannot be written.

Written as a name in JSON ("SingleAnswer"), not a number.