Conversation
wait_condition used poll_fn that ignored the waker context (_cx), returning Poll::Pending without registering any waker. This works at the top level of a workflow run method where the SDK re-polls unconditionally on every activation. However, when wait_condition is used inside a waker-based combinator like FuturesOrdered (e.g. via a ToolCallHandler future), the combinator never re-polls the inner future because no waker was triggered. Fix: store the waker from cx when returning Pending, and drain/wake all stored wakers after every state_mut call. This is deterministic because wakers are purely in-process scheduling — no I/O, timers, or randomness. All execution remains single-threaded on the LocalSet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mfateev
force-pushed
the
fix/wait-condition-wakers
branch
from
February 23, 2026 05:32
9b69124 to
7533b84
Compare
Exercises the exact bug scenario: wait_condition inside FuturesUnordered, which gives each sub-future its own waker and only re-polls when that waker fires. Without the waker fix, this test hangs because FuturesUnordered never re-polls the wait_condition future. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mfateev
force-pushed
the
fix/wait-condition-wakers
branch
from
February 23, 2026 05:34
7533b84 to
871a847
Compare
chris-olszewski
left a comment
Member
There was a problem hiding this comment.
This was addressed on master in https://github.com/temporalio/sdk-core/pull/1118/changes
I pulled out the test to #1128 as we should have coverage for this.
Member
Author
|
Great, I didn't realize that the release was from the master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wait_conditionfutures are used inside waker-based combinators likeFuturesUnordered. Previously,wait_conditionreturnedPoll::Pendingwithout registering a waker, sostate_mutchanges would never re-poll the condition.condition_wakers: Rc<RefCell<Vec<Waker>>>toWorkflowContext— wakers are registered onPendingand drained/woken on everystate_mutcall.wait_condition+FuturesUnorderedwith a timer-triggered state mutation.Test plan
cargo check --testspasses with no new warningswait_condition_waker_in_futures_unorderedtest passes against mock history🤖 Generated with Claude Code