Allow normal polling when sticky is saturated - #1579
Open
yuandrew wants to merge 4 commits into
Open
Conversation
Sushisource
approved these changes
Sep 3, 2026
Comment on lines
132
to
+135
| if let Some(max_slots) = self.max_slots | ||
| && let Some((sticky_active, non_sticky_active)) = | ||
| self.sticky_active.get().zip(self.non_sticky_active.get()) | ||
| && let Some(sticky_active) = self.sticky_active.get() | ||
| && let Some(sticky_target) = self.sticky_target.get() | ||
| && let Some(non_sticky_active) = self.non_sticky_active.get() |
Member
There was a problem hiding this comment.
This implies to me that we should see if we can find a way to just bundle up all the things that aren't max_slots into one here
Contributor
Author
There was a problem hiding this comment.
these values come from separate poller constructors. Bundling them would require a larger construction refactor, and grouping them here would only be cosmetic. I don’t think it’s worth the added complexity.
yuandrew
enabled auto-merge (squash)
September 4, 2026 00:47
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3cd384. Configure here.
yuandrew
disabled auto-merge
September 4, 2026 00:52
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.

What was changed
We now only prioritize sticky when its backlog exceeds its active pollers and its active count is below its autoscaling target.
Why?
Sticky backlog could keep normal workflow pollers waiting after sticky pollers reached their autoscaling target. Because sticky could not add another poller, shared workflow slots could remain unused.
Share the sticky poller target with workflow poll admission. Sticky backlog now receives priority only while another sticky poller can start. Normal pollers may use spare capacity once sticky reaches its target.
Checklist
Closes
How was this tested:
Note
Medium Risk
Touches core workflow long-poll admission and sticky/non-sticky balancing; incorrect logic could misallocate pollers under load, though behavior is covered by new tests.
Overview
Fixes workflow poll balancing so a sticky backlog no longer blocks non-sticky pollers after sticky pollers are already at their configured or autoscaled limit.
Sticky priority now applies only when backlog is meaningful, backlog exceeds active sticky pollers, and sticky active count is below the sticky scaler target. Sticky admission also refuses extra sticky pollers when active count has reached that target, freeing shared workflow slots for normal polling.
The sticky poller autoscaling target is published from
PollScalervia awatchchannel (replacing an atomic) and wired intoWFTPollerShared, so the balancer reacts when the target changes. New unit tests cover target-aware priority and waking waiters on target updates.Reviewed by Cursor Bugbot for commit 82e49c2. Bugbot is set up for automated code reviews on this repo. Configure here.