Parent: #1235
Blocked by: #1236
Summary
Implement the DAG scheduler that drives parallel task execution through existing SubAgentManager infrastructure.
Branch: feat/m33/orchestration-scheduler
Deliverables
New files
crates/zeph-core/src/orchestration/scheduler.rs — DagScheduler, SchedulerAction, TaskEvent, TaskOutcome
crates/zeph-core/src/orchestration/router.rs — AgentRouter trait + RuleBasedRouter impl
Modified files
crates/zeph-core/src/subagent/manager.rs — add completion_tx: Option<mpsc::Sender<TaskEvent>> to SubAgentHandle, fire on loop termination. Add spawn_for_task() method.
Key design decisions
- ADR-026: Command pattern — scheduler produces
SchedulerAction values, caller executes against manager. No &mut SubAgentManager held across await points.
- ADR-027: Single
mpsc::Sender<TaskEvent> channel for all agent completions (not per-agent watch receivers).
- Cross-task context:
<completed-dependencies> block injected into task prompt with dependency_context_budget (16384 chars total, divided equally across deps).
- Task timeout: wall-clock monitoring via
task_timeout_secs config.
- Concurrency: respects both
max_parallel and SubAgentManager.max_concurrent.
Scheduler tick loop
- Drain pending
TaskEvents from event_rx
- Update task statuses, call
ready_tasks() for newly schedulable tasks
- Route ready tasks to agents via
AgentRouter
- Emit
SchedulerAction::Spawn for each (up to concurrency limit)
- If no running/ready tasks and all terminal →
Done
Router fallback chain
task.agent_hint exact match against loaded definitions
- Tool requirement matching (future: task keywords → agent tool policy)
- First available agent (fallback)
Tests (~20)
Dependencies
Blocked by: Phase 1 (#1236)
Can run in parallel with: Phase 2 (#1237)
Parent: #1235
Blocked by: #1236
Summary
Implement the DAG scheduler that drives parallel task execution through existing SubAgentManager infrastructure.
Branch:
feat/m33/orchestration-schedulerDeliverables
New files
crates/zeph-core/src/orchestration/scheduler.rs—DagScheduler,SchedulerAction,TaskEvent,TaskOutcomecrates/zeph-core/src/orchestration/router.rs—AgentRoutertrait +RuleBasedRouterimplModified files
crates/zeph-core/src/subagent/manager.rs— addcompletion_tx: Option<mpsc::Sender<TaskEvent>>toSubAgentHandle, fire on loop termination. Addspawn_for_task()method.Key design decisions
SchedulerActionvalues, caller executes against manager. No&mut SubAgentManagerheld across await points.mpsc::Sender<TaskEvent>channel for all agent completions (not per-agent watch receivers).<completed-dependencies>block injected into task prompt withdependency_context_budget(16384 chars total, divided equally across deps).task_timeout_secsconfig.max_parallelandSubAgentManager.max_concurrent.Scheduler tick loop
TaskEvents fromevent_rxready_tasks()for newly schedulable tasksAgentRouterSchedulerAction::Spawnfor each (up to concurrency limit)DoneRouter fallback chain
task.agent_hintexact match against loaded definitionsTests (~20)
Dependencies
Blocked by: Phase 1 (#1236)
Can run in parallel with: Phase 2 (#1237)