fix(orchestration): exponential backoff in DagScheduler when concurrency limit hit#1620
Merged
fix(orchestration): exponential backoff in DagScheduler when concurrency limit hit#1620
Conversation
…ncy limit hit When all SubAgentManager slots are occupied, DagScheduler::wait_event() was sleeping the fixed deferral_backoff (250ms) and retrying immediately, producing a tight spin that flooded logs with ERROR messages every 250ms. Replace the fixed sleep with exponential backoff: each consecutive ConcurrencyLimit failure doubles the delay (250ms → 500ms → 1s → 2s → 4s), capped at 5 seconds. The counter resets to zero on the first successful spawn. Adds three regression tests covering backoff growth, counter reset, and counter increment. Closes #1618.
c2a0672 to
f10f874
Compare
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
DagScheduler::wait_event()was sleeping a fixed 250ms and retrying whenSubAgentManagerwas saturated, causing a tight spin loop that flooded logs withERROR spawn_for_task failed: concurrency limit reachedevery 250msconsecutive_spawn_failures: u32field toDagScheduler; helpercurrent_deferral_backoff()computes the scaled durationTest plan
test_current_deferral_backoff_exponential_growth— verifies doubling per failure, cap at 5stest_record_spawn_resets_consecutive_failures— verifies counter reset on successtest_record_spawn_failure_increments_consecutive_failures— verifies counter increment perConcurrencyLimitfailuretest_wait_event_sleeps_deferral_backoff_when_running_empty— existing regression test still passesCloses #1618.