fix(orchestration): prevent DagScheduler deadlock on concurrency exhaustion (#1619)#1624
Merged
fix(orchestration): prevent DagScheduler deadlock on concurrency exhaustion (#1619)#1624
Conversation
…ustion (#1619) When a sub-agent spawned during planning occupies the only concurrency slot, DagScheduler tasks were silently failing with ConcurrencyLimitReached and the plan never progressed. - Raise default max_concurrent from 1 to 5 (must be >= max_parallel + 1 when orchestration is active) - Add reserved_slots to SubAgentManager so orchestration reserves capacity before entering the scheduler loop; reservation is released unconditionally on scheduler exit - Replace fixed 250 ms spin with exponential backoff (100 ms base, x2 per retry, 5 s cap) when ConcurrencyLimit is returned; log at WARN level with active/max/consecutive_deferrals fields instead of DEBUG - Emit startup warning when max_concurrent < max_parallel + 1 - Add 6 regression tests covering reservation blocking, release, and backoff behaviour
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
max_concurrentdefault from 1 → 5 (must be ≥max_parallel + 1when orchestration is active)SubAgentManagerso planning-phase sub-agents cannot starve orchestration task spawningConcurrencyLimit; downgrades log level from ERROR to WARN with structured fieldswarn!whenmax_concurrent < max_parallel + 1Closes #1619
Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspassescargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 5174 tests passtest_reserve_slots_blocks_spawn,test_release_reservation_allows_spawn,test_reservation_with_zero_active_blocks_spawn,test_consecutive_deferrals_increments_on_concurrency_limit,test_consecutive_deferrals_resets_on_success,test_exponential_backoff_duration