feat(orchestration): DAG TaskGraph + pre-execution validation - #47016
feat(orchestration): DAG TaskGraph + pre-execution validation#47016kuangmi-bit wants to merge 2 commits into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the DAG validation work. Current main needs substantial integration work before this can safely land.
Problems
src/orchestration/delegate_runner.py:51passestoolsetstodelegate_task, but current main removed that argument inba0bc01d1; this path will raise before a child starts.src/orchestration/multi_agent_orchestrator.py:29buildsTaskGraphwithout callingvalidate_dag, so the advertised depth/orphan/blast-radius pre-flight checks never gate execution.- Parallel waves reach
asyncio.to_thread(delegate_runner.py:81), while_temporary_environmutates process-globalos.environ(delegate_runner.py:47); concurrent nodes can cross-contaminateprofile_env. - The existing Kanban graph already rejects cycles and dependency-gates work (
hermes_cli/kanban_db.py:2814-2841) and dispatches ready tasks (hermes_cli/kanban_db.py:7240-7309).
Suggested changes
- Rework against the current delegation contract, integrate validation into the actual execution path, and avoid global environment mutation.
- Re-scope around a concrete Kanban integration; remove unused bus/registry pieces, or wire and test them.
broadcast_tool_hintalso only constructs a message atagent_bus.py:53-65, as noted in the prior review.
Automated hermes-sweeper review.
| raw = delegate_task( | ||
| goal=spec.goal, | ||
| context=merged_ctx or None, | ||
| toolsets=list(spec.toolsets) if spec.toolsets else None, |
There was a problem hiding this comment.
Blocking: current main removed the toolsets parameter from delegate_task in ba0bc01, so this call raises TypeError before any child starts. Child toolsets now inherit from the parent; rework this bridge around that contract.
| env_updates = dict(spec.profile_env or {}) | ||
| env_updates.update(optional_honcho_env_patch()) | ||
|
|
||
| with _temporary_environ(env_updates): |
There was a problem hiding this comment.
Blocking: this mutates process-global os.environ, but parallel graph roots reach this code concurrently through asyncio.to_thread. Two nodes with different profile_env values can observe or restore each other's environment; use explicit child configuration or process isolation instead.
| parent_agent: Any, | ||
| specs: Sequence[GraphTaskSpec], | ||
| ) -> Mapping[str, GraphTaskRun]: | ||
| graph = TaskGraph(specs) |
There was a problem hiding this comment.
Blocking: this execution entry point never calls validate_dag, so depth, orphan, and blast-radius findings do not run before delegates are started. Validate here and define the reject behavior before constructing/running the graph.
| break | ||
| return out | ||
|
|
||
| def broadcast_tool_hint( |
There was a problem hiding this comment.
This method only builds an AgentMessage addressed to "*"; it never calls publish or enqueues messages for peers. Either implement real broadcast semantics with a delivery test or rename it to make the builder-only behavior explicit.
|
@teknium1 thanks for the thorough analysis. The Given the Kanban already handles cycle detection and dependency-gating, and the delegation contract has changed (toolsets removed), a full rewrite against current main is needed. Question for you: is the DAG TaskGraph direction still interesting to the project, or should I close this and focus on more targeted contributions? |
|
Closing — no maintainer response on whether the DAG/AgentContext direction is still interesting to the project. The mainframe-to-AI-agent architecture work will continue in the standalone MACS project (github.com/deeparchi-ai/macs). Happy to reopen if a maintainer signals interest. |
Multi-agent orchestration with dependency-graph execution and structured pre-flight validation. Based on work by @georgex8001 (PR NousResearch#12436) with additional validation layers. TaskGraph: DAG executor with DFS cycle detection, parallel wave execution via asyncio, fail-fast propagation (dependents -> SKIPPED). validate_dag(): pre-execution validation returning structured ValidationReport: - Cycle detection (REJECT) - Orphan detection (WARNING for zero in+out degree nodes) - Depth limit (WARNING >4, REJECT >8, configurable) - Blast radius BFS (risk level: routine/elevated/critical) AgentCommunicationBus: in-process async pub/sub for A2A messaging. MultiAgentOrchestrator: coordinates via existing delegate_task. Reflex hints: record/load failure patterns for self-improvement. Stdlib only — no new dependencies. 18 tests pass. Co-authored-by: georgex8001 <georgex8001@users.noreply.github.com>
…int + doc double-validation 1. broadcast_tool_hint now actually broadcasts to all known peers (iterates self._queues under lock, skips sender). Was dead code that constructed a message and returned it without publishing. 2. TaskGraph.__init__ now documents why _validate_specs may run twice (constructor guard is intentional even if caller ran validate_dag).
b95ba52 to
6a4571f
Compare
|
Addressed knoal's blocking review:
Branch rebased onto current main (zero conflicts). Ready for re-review. |
|
Closing as announced on Jul 18 — this was an early prototype and main has moved significantly (overlapping direction also explored in #12436). If the DAG/AgentContext direction is still wanted, a fresh PR against current main is the cleaner path. |
Summary
Multi-agent orchestration with dependency-graph execution and structured pre-flight validation, building on @georgex8001's work in #12436.
What's Included
TaskGraph — DAG Executor (
src/orchestration/task_graph.py, 280 LOC)asyncioPre-flight Validation (
validate_dag())Returns structured
ValidationReport:Supporting Modules
AgentCommunicationBus— in-process async pub/sub for A2A messagingMultiAgentOrchestrator— coordinates via existingdelegate_taskReflex hints— record/load failure patterns for self-improvementHonchoContext— long-term memory injection bridgeDesign Decisions
asyncio, no new dependenciesTests
18 tests in
tests/orchestration/test_task_graph.py:Related
Co-authored-by: @georgex8001