Skip to content

Admit settle parallel groups and wake once every member has an outcome - #1383

Merged
rmcdaniel merged 1 commit into
mainfrom
general/server-232-settle
Nov 27, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
general/server-232-settle

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

settle slice of native support for durable-workflow/.github#232, after #1376 and #1381.

What changes

  • No early wake. Inside a settle group, a member failure no longer wakes the workflow.

  • When the group closes. It closes once every member has an outcome:

    • a completed, failed or cancelled activity
    • a fired or cancelled timer
    • a completed, failed, cancelled or terminated child
    • a closed condition wait

    A retrying activity has no outcome yet. Child failures follow the same rule.

  • One wake. The last outcome wakes the workflow once. The history delivered to the worker holds each member's result or failure.

  • Legacy and propagate unchanged. Those groups keep the existing fail-fast wake.

  • Admission. settle is admitted for a worker whose registered descriptor lists it. cancel_remaining stays refused. Discovery still advertises nothing.

Tests (tests/execution/parallel_group_policies.rs)

  • settle wakes once, after the last outcome, with every member's outcome in the delivered history. A cold reopen in between changes nothing. A worker that registers only propagate cannot take the settle run.
  • A retrying member holds the group open until its final attempt.
  • propagate and settle side by side: the same failure wakes propagate and leaves settle waiting until the sibling completes.
  • A settle child group: a failed child leaves the parent asleep until its sibling completes. In a mixed group, an activity failure waits for the timer.
  • The claim vectors now use a real settle history instead of the direct history rewrite from Route explicit-policy runs only to workers that register their policies #1381.
  • Native now runs settle, so the fixture's unsupported-selected-policy refusal vector maps to cancel_remaining, which stays unadmitted.
  • Local runs:
    • SQLite: the policy file plus parallel_all, parallel_children, parallel_cancellation, grouped_condition, child cascade, retries and supervision, activity_deadlines and selections.
    • PostgreSQL 17: the policy file, parallel_all, parallel_children and grouped_condition, after rebasing onto Route explicit-policy runs only to workers that register their policies #1381's merge. Before the rebase they also passed on MySQL 8.4.
    • CI runs the full matrices.

Contract gap: the contract doesn't define an outcome for a member cancelled by something other than its group, such as a cancellation scope. This PR counts a cancelled activity, timer or child as an outcome.

🤖 Generated with Claude Code

Native refused explicit settle groups because its barrier counted only
successful members as closed and woke the workflow at the first
failure. A settle group would either wake too early or never wake.

Inside a settle group a member failure no longer wakes the workflow.
The group closes when every member has an outcome: a completed, failed
or cancelled activity, a fired or cancelled timer, a completed, failed,
cancelled or terminated child, or a closed condition wait. A retrying
activity has no outcome yet. The last outcome wakes the workflow once,
and its history holds each member's result or failure. Legacy and
propagate groups keep the fail-fast wake. settle is now admitted for a
worker whose descriptor lists it. cancel_remaining stays refused, and
discovery still advertises nothing.

Refs durable-workflow/.github#232

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent review: PASS at head 92effec

What I verified

  • Wake rule. selection_resume now runs the closure check for a failure as well as a success when any frame on the member's path is settle. children.rs applies the same rule to a failed, cancelled or terminated child.

    • Every failure-path caller passes through this check: terminal activity failure (activity_failures.rs), activity deadline timeout (activity_deadlines.rs), and child resolution.
    • Child retries still happen before the parent sees the failure.
    • Legacy and propagate groups keep the fail-fast wake. Selections are unchanged.
  • Closure rule. all_groups_closed counts these statuses on a settle frame:

    • activities: completed, failed, cancelled
    • timers: fired, cancelled
    • children: completed, failed, cancelled, terminated
    • condition waits: any closed wait

    These are the only terminal statuses Server writes to those tables. A timeout ends as failed on the activity row, and a timed-out child is recorded as failed. A retrying activity goes back to pending, so it holds the group as the contract requires. Mixed nested policies are refused at admission, so checking "any frame is settle" is safe.

  • Admission and routing.

    • ADMITTED_POLICIES is now [propagate, settle]. cancel_remaining is still refused with unsupported_by: server, and nothing is advertised in discovery.
    • The completion guard and the Route explicit-policy runs only to workers that register their policies #1381 routing fence both require the worker to register settle.
    • Remapping unsupported-selected-policy to cancel_remaining keeps that vector meaningful now that native supports settle.
  • Local run. 79 of 79 execution tests pass on SQLite: parallel_group_policies, parallel_*, grouped_condition*, selections, cancellation_scopes and repair.

  • CI. Fully green at this head: 63 pass, and the conditional candidate-qualification job was skipped.

The contract question (externally cancelled members)
Counting a member cancelled from outside the group, for example by a cancellation scope, as an outcome is correct. settle returns one outcome per member and distinguishes success from failure, and a cancellation is a failure outcome. Not counting it would leave the group open forever. A scope cancellation already creates its own workflow task, so this adds no extra wake path. It is worth one sentence in conformance/parallel-groups/README.md the next time the contract is edited.

Note for #1377 (non-blocking here)
fire_due_timers passes successful = !evaluates_receipt_prefix. For a receipt-ordered condition timeout, false means "the worker must evaluate the prefix now", not "the member failed". Inside a settle group, that call now goes through the closure check. The condition wait is still open at that point, so it won't wake. That is the same symptom #1377 already tracks for legacy groups. Whoever fixes #1377 should make that wake skip the settle closure rule, or pass the "evaluate now" reason separately.

@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 29745f4 Nov 27, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant