Skip to content

all-group after select() with an open or cancelled loser gets the loser's sequence as its base #350

Open

Description

@rmcdaniel

Found by the independent review of #348 and reproduced on published 2.19.1 and #348's head. The Server was built from server main 52e3ec00 (PHP stack, docker-compose.test.yml).

Problem 1: an all-group right after select() never schedules, and the run hangs.

sel = yield ctx.select({"t": ctx.start_timer(1), "slow": ctx.schedule_activity("slow", [])})
yield [ctx.schedule_activity("m0", [0]), ctx.schedule_activity("m1", [1])]
  1. The timer wins.
  2. The loser slow (sequence 2) is still open.
  3. The next task should schedule the group at sequences 3 and 4. Instead it completes with no commands (2.19.1). On Opt-in first-recorded-failure ordering for all() with a per-run marker (#307) #348's head it sends only the new failure-order version marker.
  4. Nothing wakes the run again.

Adding any durable step between the select and the group (for example yield ctx.start_timer(1)) avoids this.

Problem 2: cancelling a select loser after an all-group fails replay.
Same shape, with a spacer timer before the group:

  1. Catch the group failure.
  2. yield slow.cancel().
  3. Schedule a compensation.

The task that sends cancel_selection_operation and the compensation succeeds. The next task's replay fails with NonDeterministicReplayError at workflow sequence 2, which is the cancelled loser: it is matched against activity:m0. This happens on both 2.19.1 and #348's head.

Likely cause (not yet confirmed). _annotate_parallel_commands in src/durable_workflow/workflow.py (main c593df8, around line 6877) takes candidates[0].workflow_sequence as a new group's base whenever unconsumed recorded steps exist. A select loser that is open or cancelled is still such a step, so the group's base becomes the loser's sequence. In problem 1, _group_is_open then sees that sequence as already recorded and sends nothing (#338's no-resend rule). Problem 2 looks like the same misbinding on replay.

Acceptance

  • A list group yielded right after a select() with an open or cancelled loser schedules at the next free sequence.
  • A cancelled loser replays without nondeterminism.
  • Replay regression fixtures for both cases, recorded on a Server.
  • Existing histories that used a spacer step replay unchanged.

Activity

  1. added
    bugSomething isn't working
    kind:defectA public product behavior is incorrect
    priority:P1High-priority product or release risk
    on Nov 19, 2026
  2. rmcdaniel commented on Nov 19, 2026

    @rmcdaniel
    MemberAuthor

    Further case from the #348 re-review: a list group written immediately after a select(), or immediately after an update is applied, takes a base sequence that collides with an already-recorded step. On published 2.19.1 the group is then never scheduled and the run hangs. The acceptance criteria should cover both positions: directly after a select() with an open or cancelled loser, and directly after an applied update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkind:defectA public product behavior is incorrectpriority:P1High-priority product or release risk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions