feat(orchestration): typed ConcurrencyLimit error, edge-case tests, cancel token#1606
Merged
feat(orchestration): typed ConcurrencyLimit error, edge-case tests, cancel token#1606
Conversation
…ancel token (#1515 #1516 #1457) #1515: Add SubAgentError::ConcurrencyLimit { active, max } to replace fragile string matching in record_spawn_failure(). Both spawn() and resume() in SubAgentManager emit the typed variant. DagScheduler's record_spawn_failure now accepts &SubAgentError and uses matches!. #1516: Add three DagScheduler edge-case tests for concurrency deferral: - test_concurrency_deferral_does_not_affect_running_task - test_max_concurrent_zero_no_infinite_loop - test_all_tasks_deferred_graph_stays_running #1457: Add plan_cancel_token: Option<CancellationToken> to Agent. run_scheduler_loop gains a tokio::select! on the token at wait_event() and around RunInline execution. handle_plan_cancel fires the token for in-flight plans. Token always cleared on both Ok and Err paths (CRIT-07). Known limitation: delivery path requires agent loop restructure (SEC-M34-002).
…#1599 changelog - REV-01: Fix stale doc comments in spawn() and resume() that still referenced SubAgentError::Spawn for concurrency limit; now reference SubAgentError::ConcurrencyLimit - REV-02: Create follow-up GitHub issue #1603 (SEC-M34-002) for restructuring the agent message loop to enable /plan cancel delivery during run_scheduler_loop; update all code comments with the issue number - REV-CHANGELOG: Restore accidentally removed #1599 entry (scheduler not initialized in ACP mode) from the Fixed section - REV-03: Add TODO comment at inline cancel TaskOutcome referencing #1603 - REV-04: Add biased; to wait_event tokio::select! to make cancel priority over task completion events explicit
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
orchestration: replace concurrency-limit string matching with typed SubAgentError variant #1515: Replace fragile
error.contains("concurrency limit")string matching inDagScheduler::record_spawn_failure()with typedSubAgentError::ConcurrencyLimit { active, max }variant. Updatedspawn(),resume(), andspawn_for_task()inSubAgentManagerto return the typed variant. Updated all call sites and 6 existing tests.orchestration: add edge-case tests for DagScheduler concurrency-deferral #1516: Add 3 missing edge-case tests for DagScheduler concurrency-deferral in
scheduler.rs:test_concurrency_deferral_does_not_affect_running_task— running task unaffected when peer hits concurrency limittest_max_concurrent_zero_no_infinite_loop— degeneratemax_concurrent=0config stalls without loopingtest_all_tasks_deferred_graph_stays_running— all tasks deferred revert to Ready, no prematureDone(Failed)feat(orchestration): add CancellationToken to allow /plan cancel during execution #1457: Add
CancellationToken(tokio_util::sync) toAgentto allow/plan cancelto interruptrun_scheduler_loop. Token is created per plan execution inhandle_plan_confirm(), always cleared in both Ok/Err arms, and fired byhandle_plan_cancel().tokio::select!(biased toward cancel) added atwait_event()and aroundRunInlinein the tick loop.Known limitation (SEC-M34-002, tracked in orchestration: restructure agent message loop to allow /plan cancel delivery during run_scheduler_loop (SEC-M34-002) #1603): since
run_scheduler_loopholds&mut self, the agent message loop cannot deliver/plan cancelwhile the loop is executing. Token plumbing is complete and tested; the delivery path requires agent loop restructuring tracked in orchestration: restructure agent message loop to allow /plan cancel delivery during run_scheduler_loop (SEC-M34-002) #1603.Test plan
test_concurrency_deferral_does_not_affect_running_task,test_max_concurrent_zero_no_infinite_loop,test_all_tasks_deferred_graph_stays_running)cargo clippy --workspace --features full -- -D warnings: 0 warningscargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins: 5139/5139 passedCloses #1515
Closes #1516
Closes #1457