Skip to content

fix(orchestration): do not cancel sub-agents on stdin EOF when plan tasks are running#3076

Merged
bug-ops merged 2 commits intomainfrom
3063-plan-confirm-piped-cli
Apr 17, 2026
Merged

fix(orchestration): do not cancel sub-agents on stdin EOF when plan tasks are running#3076
bug-ops merged 2 commits intomainfrom
3063-plan-confirm-piped-cli

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 17, 2026

Summary

  • scheduler_loop was cancelling all running sub-agents immediately on stdin EOF, making /plan confirm silently fail with 0/N tasks completed in piped CLI mode
  • Added DagScheduler::has_running_tasks() — O(1) check on the running set
  • Added stdin_closed flag to run_scheduler_loop: when stdin is exhausted but tasks are still active, the recv arm is replaced with std::future::pending() (no spin) and the loop waits for natural task completion via wait_event(); cancellation on EOF only fires when the running set is empty

Test plan

  • has_running_tasks_false_on_empty_scheduler — returns false on empty scheduler
  • has_running_tasks_true_after_record_spawn — returns true when tasks are registered
  • stdin_closed_parks_when_tasks_running (COV-05) — channel EOF + running task → loop parks, task completes naturally → GraphStatus::Completed
  • stdin_closed_exits_when_no_tasks (COV-06) — channel EOF + no running tasks → exits immediately → GraphStatus::Canceled
  • All existing scheduler_loop_channel_close_* tests pass unchanged
  • 8102/8102 tests pass

Closes #3063

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Apr 17, 2026
bug-ops added 2 commits April 17, 2026 11:26
…asks are running

In piped CLI mode, scheduler_loop detected channel close (stdin EOF) and
immediately cancelled all running sub-agents, making /plan confirm
silently fail with 0/N tasks completed.

Add has_running_tasks() to DagScheduler and a stdin_closed flag to the
scheduler loop. When stdin is exhausted but tasks are still active, the
loop parks (recv arm replaced with std::future::pending()) and waits for
natural task completion via wait_event(). Cancellation on EOF only
triggers when the running set is empty, preserving existing behaviour.

Closes #3063
@bug-ops bug-ops force-pushed the 3063-plan-confirm-piped-cli branch from 603911d to 8f13f51 Compare April 17, 2026 09:26
@bug-ops bug-ops enabled auto-merge (squash) April 17, 2026 09:26
@bug-ops bug-ops merged commit ab185bd into main Apr 17, 2026
32 checks passed
@bug-ops bug-ops deleted the 3063-plan-confirm-piped-cli branch April 17, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(orchestration): /plan confirm aborts immediately in piped CLI mode — scheduler_loop cancels sub-agents on stdin EOF

1 participant