fix(orchestration): do not cancel sub-agents on stdin EOF when plan tasks are running#3076
Merged
fix(orchestration): do not cancel sub-agents on stdin EOF when plan tasks are running#3076
Conversation
…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
603911d to
8f13f51
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
scheduler_loopwas cancelling all running sub-agents immediately on stdin EOF, making/plan confirmsilently fail with 0/N tasks completed in piped CLI modeDagScheduler::has_running_tasks()— O(1) check on the running setstdin_closedflag torun_scheduler_loop: when stdin is exhausted but tasks are still active, the recv arm is replaced withstd::future::pending()(no spin) and the loop waits for natural task completion viawait_event(); cancellation on EOF only fires when the running set is emptyTest plan
has_running_tasks_false_on_empty_scheduler— returns false on empty schedulerhas_running_tasks_true_after_record_spawn— returns true when tasks are registeredstdin_closed_parks_when_tasks_running(COV-05) — channel EOF + running task → loop parks, task completes naturally →GraphStatus::Completedstdin_closed_exits_when_no_tasks(COV-06) — channel EOF + no running tasks → exits immediately →GraphStatus::Canceledscheduler_loop_channel_close_*tests pass unchangedCloses #3063