Repository navigation
Keep the 24h barrier TTL when the middleware re-opens a barrier - #17
Merged
Merged
Conversation
Workflow creates each completion barrier with CALLBACK_BARRIER_TTL (24h), but WorkflowMiddleware re-opened it without a ttl, so every Barrier.wait() rewrote the key with AtMostOnceBarrier's 15-minute default. If two tasks in a Group finished more than 15 minutes apart, the key expired, the next decrement read it as 0, and the barrier released early: the step after the Group ran while some of its tasks were still running. Pass ttl=CALLBACK_BARRIER_TTL in the middleware too, and add a regression test that advances the rate limiter's clock an hour between completions. Reported by an external contributor by email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CgvUKo69g5ofiU4RbGfWF8 Co-authored-by: nils <nils@outset.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CgvUKo69g5ofiU4RbGfWF8 Co-authored-by: nils <nils@outset.ai>
skippyoutset
approved these changes
Nov 16, 2026
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.
Problem
Workflowcreates each completion barrier withCALLBACK_BARRIER_TTL(24h), butWorkflowMiddleware._process_completion_callbacksre-opened it without attl. EveryBarrier.wait()callsbackend.decr(key, 1, 1, self.ttl), which rewrites the key (SET ... PX=ttlon Redis) withAtMostOnceBarrier's 15-minute default.So in
Chain(Group(a, b, c), d), if consecutive tasks in the group finish more than 15 minutes apart, the barrier key expires. The next decrement reads it as 0,decrreturnsFalse, the barrier counts as released, anddis enqueued while the rest of the group is still running. The_rankey still keeps it to one release, sodruns once, just too early.Fix
Pass
ttl=CALLBACK_BARRIER_TTLwhen the middleware builds the barrier, matching howWorkflowcreates it.Tests
test_barrier_outlives_default_ttl_between_completionsadvancesStubBackend's monotonic clock an hour between completions of a three-task barrier. It fails onmain(enqueued after the second completion) and passes with the fix.Release
Bumps
setup.pyto 0.4.1. Merge this before creating thev0.4.1GitHub release: the release workflow builds fromsetup.py, so creating the release first would try to upload 0.4.0 to PyPI again.Reported by Jeetu SK (@JeetuSK0808), with a detailed analysis of the cause.
https://claude.ai/code/session_01CgvUKo69g5ofiU4RbGfWF8
Generated by Claude Code