feat(orchestration): allow /plan cancel delivery during run_scheduler_loop#1616
Merged
feat(orchestration): allow /plan cancel delivery during run_scheduler_loop#1616
Conversation
…_loop (#1603) Poll channel.recv() concurrently with scheduler.wait_event() inside run_scheduler_loop() via tokio::select!. This unblocks /plan cancel delivery on CLI and synchronous channels where the main dispatch loop is paused while the scheduler holds &mut self. Cancel delivery paths: - cancel_token.cancelled(): for TUI, Telegram, ACP (concurrent event loops that can call handle_plan_cancel() independently) - channel.recv("/plan cancel"): for CLI (blocked during scheduler loop) On cancel: sends "Canceling plan..." status, calls cancel_all(), forwards SchedulerAction::Cancel actions to subagent_manager, exits with GraphStatus::Canceled. Non-cancel messages are queued via enqueue_or_merge(). finalize_plan_execution() gains a dedicated Canceled arm that reports "N/M tasks completed" without storing the graph to pending_graph (canceled plans are not retryable). Follow-up issues: #1611 (COV-03), #1612 (IMPL-02), #1613 (IMPL-03), #1614 (COV-04)
aef6363 to
8914130
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
channel.recv()polling insiderun_scheduler_loop()viatokio::select!, allowing/plan cancelto be delivered on CLI and synchronous channels that were previously blocked while the scheduler held&mut selfcancel_token.cancelled()arm (from feat(orchestration): typed ConcurrencyLimit error, edge-case tests, cancel token #1606) to support both concurrent channels (TUI, Telegram, ACP) and the blocked CLI pathGraphStatus::Canceledarm infinalize_plan_execution()that reports N/M task progress without storing the graph for retryCloses #1603
Test plan
plan_cancel_during_scheduler_loop_cancels_plan— verifies cancel is picked up via channel.recv(), cancel_all() called, Canceled status returned, "Canceling plan..." sentfinalize_plan_execution_canceled_does_not_store_graph— verifies N/M message and no pending_graph storage