Repository navigation
Keep a condition wait's deadline across false wakes - #188
Conversation
The Server wakes an open condition wait on any signal and records it satisfied. When the predicate was still false the worker reopened the wait with the full timeout_seconds, so every non-matching signal moved the deadline. Reopen with the time remaining since the first ConditionWaitOpened (rounded up, clamped to 0..=authored), matching sdk-php#271. A reopen past the deadline opens with timeout 0 so the Server resolves it. Replay accepts a reopen at or below the authored timeout; longer stays non-deterministic. Fixes #187 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Evidence at head 748a21e. Local full suite (macOS arm64, Rust 1.86.0, Live check on published native Server 3.0.5 ( 284 = ceil(300 − (03:21:32.789 − 03:21:16.569)). The second timer is due at 03:26:16.83, which keeps the first open's deadline. On main the same probe gave |
Adds General's sdk-php#271 review vectors: a grace wait after a timeout reopens with 31 (not 0), an equal-timeout wait with 271, and an approve in the grace wait returns late. Rust links reopens by condition_wait_occurrence_id, so a separate wait never inherits an earlier deadline. CHANGELOG notes the rollback constraint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
General interim review (Security unavailable), exact head Verified in a bounded container (Rust 1.86.0): full suite 773/0, corpus 28/28, CI green. The fix is correct for waits outside parallel/select groups:
Blocker: timed condition waits in parallel/select groups.
Non-blocking
|
recorded_condition_group_path required a grouped reopen's timeout_seconds to equal the original open's, so a parallel or select member reopened with the remaining time failed the next task with condition_wait_group_reopen_mismatch. Accept a reopen at or below the original timeout (both present, or both absent); a longer or missing timeout is still refused. Adds a grouped unit test and the grouped-condition-timed-reopen-keeps-deadline corpus fixture. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
|
General interim review (Security unavailable), exact head What changed since the grouped HOLD at bb8b952
Verified in a bounded container running Rust 1.86.0: full suite 774/0, corpus 28/28, CI green.
Follow-up, not blocking, and older than this PR: when both condition members of one group are woken falsely, the next task can miss the reopen of a member whose next command belongs to the other member, because the replay loop only looks at the immediately following command. Please file it, and confirm it against a live Server's sequence layout. sdk-rust may merge exactly this SHA. It goes into 4.11.2 if it lands before the H freeze. |
The PHP Server accepts a grouped (parallel/select) condition reopen only when its timeout_seconds equals the original and latest opens (recordedGroupedConditionReopenMatches); durable-workflow#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 durable-workflow#189 Co-Authored-By: Claude Opus 5.5 <[email protected]>



Fixes #187. Parity with sdk-php#269(a) (sdk-php#271) and sdk-python#245/#246, so all three SDKs emit the same timeout for the same history.
Problem
The Server wakes an open condition wait on any signal and records
ConditionWaitSatisfied. If the predicate is still false, the worker reopens the same logical wait (samecondition_wait_occurrence_id, new sequence). It used to send the full authoredtimeout_seconds, so each non-matching signal pushed the deadline back. Confirmed live on published native Server 3.0.5 (sha256:3cb6e5bf…): a 300 s wait opened at 03:09:38.266, a non-matching vote arrived at 03:09:54, and the reopen at 03:09:54.391 asked for 300 s instead of 284. Full history is on #187.Change (
src/lib.rs)The rule is the same as sdk-php#271:
timeout_seconds = clamp(ceil(authored − (latest history event time − first ConditionWaitOpened time)), 0, authored). Times come from the event'stimestamp, falling back torecorded_at, as Register each cold logging worker before polling #271 does. The deadline is always measured from the first physical open, whatever the earlier reopens recorded.timeout_seconds: 0rather than resolving locally, so the Server closes its wait and timer as timed out (Register each cold logging worker before polling #271's "false wake after the deadline" →0). New waits keep the existing local zero-timeout behavior.condition_wait_timeout_mismatch.wait_conditionrustdoc: "The timeout runs from the first time the wait opens."Tests
reopened_condition_wait_keeps_its_first_opening_deadline, with Register each cold logging worker before polling #271's vectors: a 300 s wait opened at 02:36:05.295.180.61, after either a full-timeout (300) or remaining-time (180) reopen.0.Satisfiedwith no command.300is kept.a_reopen_longer_than_the_authored_timeout_is_not_the_same_wait: a301reopen givescondition_wait_timeout_mismatchat sequence 2.condition-wait-false-wake-keeps-deadline.json, mirroring Register each cold logging worker before polling #271's: oncorpus.condition-search, a 30 s wait at 02:36:05 and arejectsignal at 02:36:17 must reopen with18, same occurrence id, key and fingerprint.Counterfactuals:
300vs180) and the corpus fixture fails (expected 18, observed 30).Ready(TimedOut)instead of sending a0reopen.Local (macOS arm64, Rust 1.86.0): the 15 condition tests and the corpus (28/28) pass; fmt and clippy are clean. The full-suite result follows in a comment.
Release: General approved this for 4.11.2 if it clears before H is frozen.
🤖 Generated with Claude Code