diff --git a/docs/reference/workflow.md b/docs/reference/workflow.md index e9d2e079..07f2da64 100644 --- a/docs/reference/workflow.md +++ b/docs/reference/workflow.md @@ -45,9 +45,12 @@ the run. Once history records the application, it is a `NonDeterministicReplayError` with `reason: recorded_command_detail_mismatch`, and the Server holds the run for repair. A missing handler faults the task only when a `SignalApplied` or a `ConditionWaitSatisfied` names the signal. -Otherwise the signal is skipped. On a run without a contract, that includes a -handled signal that woke a condition wait without satisfying it, so keep a -signal handler registered while runs that used it are open. See +Otherwise the signal is skipped. Starting with Native Server 3.38.1, a +handled signal leaves a `SignalApplied` event when its task completes +successfully and the worker declared the handler at registration, including +when the condition stays false. Histories from older versions can have only a +cursor advance for these signals on runs started without a signal contract. +Keep a signal handler registered while runs that used it are open. See [Workflow signals, queries, and updates](../sdk-reference.md#workflow-signals-queries-and-updates). Update-handler exceptions fail the update, validator exceptions reject it, and query-handler exceptions fail the query. They do not silently succeed. diff --git a/docs/sdk-reference.md b/docs/sdk-reference.md index dc28dea3..c60ec8b0 100644 --- a/docs/sdk-reference.md +++ b/docs/sdk-reference.md @@ -825,21 +825,21 @@ workflow task replays it. When the worker replays it: repair. Every workflow task replays each received signal through its handler. The -worker treats a signal as applied when history records its application by a -completed workflow task. Any one of these rows is that record: - -- `SignalApplied` naming the signal. The Server writes it when the run's - contract declares the signal: the contract captured at start, or, for a - continue-as-new run or a run with ordered condition waits, the contract its - first accepted task bound. +first two rows below identify a handler application. The cursor row records +consumption. + +- `SignalApplied` naming the signal. A named signal wait or the run's contract + can establish the application. The Server can capture the contract at start + or bind it on the first accepted task for continue-as-new runs and runs with + ordered condition waits. The version note below describes how Native Server + 3.38.1 also uses worker registration to establish the application. - `ConditionWaitSatisfied` naming the signal (`workflow_signal_id`). The Server writes it when the signal satisfies a condition wait. For a wait under the default resolution clock, that means the worker confirmed the satisfaction. This is written whether or not the run has a contract. - `MessageCursorAdvanced` that moves the run's instance message cursor to the signal's message position. The Server writes it whenever a task consumes the - signal, including for a signal that no handler takes. It shows the - application, but not that a handler took the signal. + signal, including for a signal that no handler takes. A faulted task writes none of these rows. When the worker applies a signal: @@ -875,16 +875,18 @@ only when the signal's own task completes. Until then, a handler that raises on that signal is reported as `signal_handler_failed`, not as `recorded_command_detail_mismatch`. -A run without a contract has a second limit. On such a run, a handled signal -that wakes a condition wait without satisfying it is recorded only by its -cursor advance, for example the first of several signals that a predicate -needs. A false wake under the default resolution clock is the same case. History -cannot tell that signal apart from a misnamed signal that no handler took. A -worker that no longer registers the signal's handler therefore skips it, and -the handler's effect is lost without a fault. This is a deliberate trade-off: -faulting would hold every run without a contract that receives a misnamed -signal until a worker registers a handler with that name. Keep a signal handler -registered while runs that used it are open. +Starting with Native Server 3.38.1, a signal task that completes successfully +records `SignalApplied` when the worker declared the handler at registration. +This includes runs started before any worker registered and signals that wake +a condition without satisfying it. If that signal satisfies the condition, +`SignalApplied` and `ConditionWaitSatisfied` identify the same signal. + +Older Native Server versions can record only a cursor advance when a handled +signal wakes a condition without satisfying it on a run started without a +signal contract. Those histories remain ambiguous after an upgrade. If a +replacement worker lacks the handler, it skips a signal recorded only by its +cursor advance, and any handler effect is lost on replay. Keep a signal +handler registered while runs that used it are open. `Client.update_workflow()` (and `WorkflowHandle.update()`) returns the Server receipt, not the decoded handler result. When `wait_for` is omitted the Server