Skip to content

feat(scheduler): cancel sub-agents on channel close and shutdown signal#1692

Merged
bug-ops merged 2 commits intomainfrom
feat-cancel-sub-agents-on-chan
Mar 13, 2026
Merged

feat(scheduler): cancel sub-agents on channel close and shutdown signal#1692
bug-ops merged 2 commits intomainfrom
feat-cancel-sub-agents-on-chan

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

  • In run_scheduler_loop(), both abnormal exit branches (Ok(None)|Err(_) channel close and shutdown_signal()) now call scheduler.cancel_all() and forward the returned Cancel actions to SubagentManager::cancel(), preventing orphaned sub-agent tasks from consuming resources after the loop exits
  • Added tracing::warn!(sub_agents = n, ...) in both branches to log abnormal exits with the count of cancelled sub-agents
  • Added missing defensive GraphStatus::Canceled fallback to the /plan cancel branch (parity with existing cancel_token branch)
  • Refactored match result { Ok(Some(msg)) => ... Ok(None)|Err(_) => ... } to if let ... else to satisfy clippy::single_match_else and clippy::redundant_else

Test plan

  • cargo +nightly fmt --check passes
  • cargo clippy --workspace --features full -- -D warnings passes
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 5288 passed, 12 skipped

Closes #1613

In run_scheduler_loop(), the Ok(None)|Err(_) and shutdown_signal()
branches now call scheduler.cancel_all() and forward the returned
Cancel actions to SubagentManager::cancel(), preventing orphaned
sub-agent tasks from consuming resources after the scheduler loop exits.

Also adds tracing::warn! with sub-agent count in both abnormal exit
branches, and adds the missing defensive GraphStatus::Canceled fallback
to the /plan cancel branch (identified in code review).

Closes #1613
@github-actions github-actions Bot added enhancement New feature or request documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate size/M Medium PR (51-200 lines) labels Mar 13, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 13, 2026 21:20
@bug-ops bug-ops merged commit 6741513 into main Mar 13, 2026
15 checks passed
@bug-ops bug-ops deleted the feat-cancel-sub-agents-on-chan branch March 13, 2026 21:34
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/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: cancel sub-agents on channel close and shutdown signal in scheduler loop

1 participant