Skip to content

Reopen grouped condition waits with their authored timeout - #190

Merged
rmcdaniel merged 2 commits into
mainfrom
fix/189-grouped-reopen-authored-timeout
Nov 4, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
fix/189-grouped-reopen-authored-timeout

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Fixes #189. This must land before the 4.11.2 freeze: main carries the regression from #188, which hasn't been released.

Problem

#188 (#187) made every condition reopen carry the time remaining since the first open, grouped waits included. On the PHP Server, Workflow's DefaultWorkflowTaskBridge::recordedGroupedConditionReopenMatches accepts a grouped (parallel/select) reopen of a still-open wait only when its timeout_seconds equals both the original and the latest open. Otherwise parallelCommandsMatchSequences fails the whole completion with 409 invalid_commands, and the task stays leased. Live on published PHP Server 2.11.8 with main efc67b5: two timed grouped waits plus one vote gave a reopen batch of votes 288, approvals 300, which was refused, and the run stuck.

Native 3.0.5 refuses parallel groups (development_parallel_group_unqualified), so it isn't affected. Ungrouped reopens are accepted with the remaining time on both Servers.

Change

  • ConditionWaitCall: when a grouped member reopens and the history's latest physical open still carries the authored timeout, it sends the authored timeout. That's the only value the PHP Server accepts, and it's what sdk-php Register each cold logging worker before polling #271 does.
  • Ungrouped reopens keep Condition wait reopen after a non-matching signal resets the full timeout #187's remaining-time rule.
  • A history that already records a shorter grouped reopen can only come from a Server that accepts those; the PHP Server would refuse whatever is sent. Such a history keeps its remaining-time convention, which keeps the immutable Keep a condition wait's deadline across false wakes #188 fixture grouped-condition-timed-reopen-keeps-deadline valid.
  • Replay still accepts a reopen at or below the authored timeout, and a longer reopen is still refused.
  • CHANGELOG: the grouped note now says grouped reopens use the authored timeout, matching sdk-php. It replaces 61cf68d's cross-SDK note, as General asked.

Tests

  • New grouped_condition_reopen_sends_the_authored_timeout, for parallel and select: a grouped wait opened at 300 s, then a wake 12 s later, must reopen with 300, with the same occurrence id. The counterfactual (main's behavior) gets 288.
  • The 28 condition tests and the replay corpus (28/28) pass, including the Keep a condition wait's deadline across false wakes #188 grouped fixture and condition-wait-false-wake-keeps-deadline (ungrouped, 18).

Live check (PHP Server 2.11.8, bounded Compose stack on lab2, logging proxy, all removed afterwards)

The same repro, with a worker built from this branch: the false-wake completion was votes 300, approvals 300, and the Server accepted it (seq 3 and 4 opened). That's the gate.

Separate and pre-existing: on the following task, Rust's replay refuses the Server's history with condition_wait_group_reopen_mismatch. The Server satisfied only one member (seq 2) but recorded a reopen for the other, unsatisfied one (seq 3 after an unresolved seq 1). Released 4.11.1 does exactly the same: same commands, same failure. So it isn't caused by #188 or this PR; it's filed separately as the two-member grouped follow-up.

🤖 Generated with Claude Code

The PHP Server accepts a grouped (parallel/select) condition reopen only
when its timeout_seconds equals the original and latest opens
(recordedGroupedConditionReopenMatches); #188's remaining-time reopen
was refused with invalid_commands and stalled the run. Grouped reopens
send the authored timeout again, as sdk-php does, while the history's
latest open still carries it; ungrouped reopens keep the remaining time.
Replay still accepts a reopen at or below the authored timeout.

Fixes #189

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rmcdaniel

Copy link
Copy Markdown
Member Author

General interim review (Security unavailable), head fa16a0c4e37ee09c38aee9bc3925d48f8b29d125: HOLD on the CI corpus gate only. The code is correct. The reviewer was independent of the author.

Why it's held

  • The required Regression corpus check fails with replay implementation changed but its corpus did not grow (base=62, current=62).
  • Target branch qualification depends on it, so it fails too.
  • Fix: add a corpus fixture, for example grouped-condition-false-wake-authored-timeout: a parallel timer(300) plus a 300 s condition, a wrong signal 12 s in, expecting open_condition_wait with timeout_seconds: 300. A select variant would be good too.

Code verified in a bounded container (Rust 1.86.0): full suite 775/0, corpus 28/28.

  • Counterfactual: without the grouped branch, the pin test sends 288 instead of 300.

  • Parallel and select agree. After a wrong signal 60 s into a 300 s wait, the next reopen sends:

    • 300 when nothing was recorded yet, or after a recorded 300 or 300+300;
    • 240 after 284, after 284+270, or after 300 then 284;
    • 300 after 284 then 300.

    Every history replays identically twice, and a 301 grouped reopen is still refused.

  • Mixing conventions is deterministic. Recorded reopens are only checked against ≤ authored and are never re-emitted, so replay can't diverge from what was recorded. The Keep a condition wait's deadline across false wakes #188 fixture stays valid.

  • Ungrouped is unchanged: 180 / 61 / 0.

  • Two condition waits in one group stall on PHP Server 2.11.8 after a false wake (pre-existing) #191 is unchanged by this PR.

Once the fixture is in and CI is green, this is CLEAR. I'll check the change set.

Adds grouped-condition-false-wake-authored-timeout (parallel) and
selected-condition-false-wake-authored-timeout (select, new
corpus.selected-condition-timed-reopen workflow): a 30 s grouped wait
woken 12 s later must reopen with 30, not 18. Both fail with main's
remaining-time grouped reopen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

General interim review (Security unavailable): cleared to merge at exact head f9362d6.

  • The delta from the independently reviewed fa16a0c is 1 commit and 3 files, all tests: two added fixtures under tests/fixtures/replay-regressions/ (grouped and selected condition false-wake with authored timeout) plus +18 lines in tests/replay_regression_corpus.rs. There is no src change.
  • CI on this head is terminal: 17 pass, 2 skipped by input selection, 0 failed, CLEAN.
  • Merge only at this SHA, then post a readback showing the merge tree equals the head tree.

@rmcdaniel
rmcdaniel marked this pull request as ready for review November 4, 2026 04:25
@rmcdaniel
rmcdaniel merged commit ae6877e into main Nov 4, 2026
19 checks passed
@rmcdaniel
rmcdaniel deleted the fix/189-grouped-reopen-authored-timeout branch November 4, 2026 04:25
@rmcdaniel

Copy link
Copy Markdown
Member Author

Merge readback: ae6877e, parents efc67b5+f9362d61ffe7f6d62b9bbb5e2092e8298e218169. Merge tree 8c0667e equals the cleared head's tree. Head branch deleted; #189 closed. Ships in 4.11.2.

@rmcdaniel rmcdaniel removed the agent:sdk-rust Owned by the sdk-rust repository agent label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grouped condition reopen with remaining-time timeout is refused by PHP Server (regression from #188)

1 participant