Skip to content

feat(orchestration): allow /plan cancel delivery during run_scheduler_loop#1616

Merged
bug-ops merged 2 commits intomainfrom
plan-cancel-scheduler-loop
Mar 13, 2026
Merged

feat(orchestration): allow /plan cancel delivery during run_scheduler_loop#1616
bug-ops merged 2 commits intomainfrom
plan-cancel-scheduler-loop

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 13, 2026

Summary

Closes #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..." sent
  • finalize_plan_execution_canceled_does_not_store_graph — verifies N/M message and no pending_graph storage
  • Full suite: 5166 tests passed, clippy clean, fmt clean

@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate enhancement New feature or request size/L Large PR (201-500 lines) labels Mar 13, 2026
bug-ops added 2 commits March 13, 2026 15:37
…_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)
@bug-ops bug-ops force-pushed the plan-cancel-scheduler-loop branch from aef6363 to 8914130 Compare March 13, 2026 14:37
@bug-ops bug-ops enabled auto-merge (squash) March 13, 2026 14:37
@bug-ops bug-ops merged commit aee9425 into main Mar 13, 2026
15 checks passed
@bug-ops bug-ops deleted the plan-cancel-scheduler-loop branch March 15, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

orchestration: restructure agent message loop to allow /plan cancel delivery during run_scheduler_loop (SEC-M34-002)

1 participant