Skip to content

Allow normal polling when sticky is saturated - #1579

Open
yuandrew wants to merge 4 commits into
mainfrom
fix-sticky-slot-admission-saturation
Open

Allow normal polling when sticky is saturated#1579
yuandrew wants to merge 4 commits into
mainfrom
fix-sticky-slot-admission-saturation

Conversation

@yuandrew

@yuandrew yuandrew commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

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 PollScaler via a watch channel (replacing an atomic) and wired into WFTPollerShared, 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.

@yuandrew
yuandrew requested a review from a team as a code owner September 3, 2026 20:00
@yuandrew yuandrew changed the title Respect sticky poller target Allow normal polling when sticky is saturated Sep 3, 2026
Comment thread crates/sdk-core/src/worker/workflow/wft_poller.rs Outdated
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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread crates/sdk-core/src/worker/workflow/wft_poller.rs Outdated
@yuandrew
yuandrew enabled auto-merge (squash) September 4, 2026 00:47

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread crates/sdk-core/src/worker/workflow/wft_poller.rs
@yuandrew
yuandrew disabled auto-merge September 4, 2026 00:52
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.

2 participants