Repository navigation
Description
Summary
The SDLC pipeline should support three tiers of dispatch complexity, matched to the nature of the task. Today we have the low end (short-circuit, PR #734) and the mid-range (single agent per role in waves). This issue covers formalizing the full tiered strategy and adding high-complexity parallel dispatch.
Reference: PR #734 introduced short-circuit mode and complexity assessment in the refine phase.
Tiered dispatch strategy
Tier 1: Low complexity (short-circuit) — already implemented
- Refine agent signals
short_circuit: true - Skips plan phase, single coder implements directly from the analysis
- For: single-file fixes, typos, small config changes
Tier 2: Mid complexity — current default
- Full plan phase produces a structured implementation plan
- Specialized agents dispatched in waves: Coder → Tester + Documenter → Integrator
- Single coder processes all tasks sequentially
- For: standard features, bug fixes, multi-file changes with clear scope
Tier 3: High complexity — new (parallel/sequential implement phases)
- Plan decomposes work into phases with a dependency graph (this already happens today)
- Each plan phase becomes its own implement cycle: Coder → Tester → Agentic Review
- Independent phases run in parallel; dependent phases run sequentially
- Each implement cycle is scoped to its phase's tasks and file boundaries
- After all implement cycles complete, an Integrator with write access merges, runs the full test suite, and fixes integration issues
- Human review covers the integrator's fixup diff + signs off on the full PR (each phase was already agentic-reviewed, so cognitive load is bounded)
- For: large features, cross-cutting changes, tasks with multiple independent work items
Tier 3 execution model
Plan produces phases with dependency ordering:
Phase 1 (tasks 1-3) ──┐
Phase 2 (tasks 4-5) ──┼── independent, run in parallel
Phase 3 (tasks 6-7) ──┘
Phase 4 (tasks 8-9) ──── depends on Phase 1, runs after it
Each implement cycle (per phase):
1. Coder: implements tasks on a sub-branch (egg/<feature>/phase-N)
2. Tester: writes/runs tests for coder's changes
3. Agentic Review: REVIEWER_CODE + REVIEWER_CONTRACT check this phase's diff
- If rejected → coder retries within this phase (no human gate)
- If approved → phase marked complete
After all phases complete:
4. Integrator: merges sub-branches, runs full test suite, fixes integration issues
5. Human Review: reviews integrator's fixup diff + approves full PR
┌─ Phase 1 (coder → tester → agentic review) ─┐
Plan ──────┤ ├─→ Integrator → Human Review → PR
├─ Phase 2 (coder → tester → agentic review) ──┤
├─ Phase 3 (coder → tester → agentic review) ──┤
└─── [waits for Phase 1] ──────────────────────┘
Phase 4 (coder → tester → agentic review) ─┘
Why implement phases, not coder+tester pairs
The plan phase already decomposes work into phases with tasks and dependencies. Rather than inventing a new task-level dispatch model with (AgentRole, TaskId) tuples, we use the plan's existing phase decomposition as the unit of parallel execution. This gives us:
- Bounded reviewer scope — each agentic review covers one phase's changes, not the full feature diff
- Early abort — if Phase 1's agentic review finds a design flaw, we stop before burning tokens on later phases
- Natural dependency ordering — the plan's phase dependency graph is already the right abstraction
- Incremental integration — problems are caught per-phase rather than at a single fan-in point
Branch strategy
Each parallel implement phase works on its own sub-branch to prevent merge conflicts:
- Phase branches:
egg/<feature>/phase-1,egg/<feature>/phase-2, etc. - Integrator merges sub-branches into the main feature branch (
egg/<feature>) - File partitioning via
files_affectedprovides a safety net but sub-branches are the primary isolation mechanism
Token cost
Tier 3 is more expensive than a single-pass implement. For a 3-phase feature:
- Tier 2: 1 coder + 1 tester + 1 documenter + 1 integrator + 2 reviewers = 6 agents
- Tier 3: 3 × (1 coder + 1 tester + 2 agentic reviewers) + 1 integrator + 2 human-facing reviewers = 15 agents
Roughly 2-2.5× the token cost. The tradeoff: the pipeline can handle features that would be unreviewable as a single diff, and early agentic review catches issues before they compound across phases.
Key changes needed
-
Complexity tier selection — Extend the refine phase's complexity assessment (from Add short-circuit mode to skip plan phase for simple tasks #734) to distinguish three tiers instead of two (short-circuit vs. not). The refine agent should signal which tier is appropriate.
-
Implement phase loop — The orchestrator runs N implement cycles (one per contract phase) instead of a single implement phase with one coder. Each cycle spawns coder → tester → agentic reviewers for that phase's tasks.
-
Phase-level dependency graph —
DependencyGraphoperates on contract phases (not agent roles or(role, task)tuples). Independent phases run in parallel; dependent phases run sequentially. The plan already produces this ordering. -
Per-phase agent execution tracking —
agent_executionskeyed by(phase_id, role)instead of justrole. ThePhaseAgentConfigmodel already supports per-phase overrides, but execution tracking doesn't. -
Integrator with write access — The integrator role gains write access to source, tests, and docs. Its responsibility shifts from "validate and report" to "merge sub-branches, run full test suite, fix integration issues, and report." This is a privilege escalation but is acceptable since it runs after all agentic reviews and before human review.
-
Per-phase sub-branches — Each implement cycle pushes to
egg/<feature>/phase-N. The integrator merges these intoegg/<feature>. Gateway needs to allow push to phase sub-branches. -
Agentic review between phases — REVIEWER_CODE and REVIEWER_CONTRACT run after each phase's coder+tester, not just at the end. If a reviewer rejects, the coder retries within that phase. No human gate between phases.
-
New pipeline stage — Either a new
PipelinePhase.INTEGRATEbetweenIMPLEMENTandPR, or the implement phase internally manages the cycle-then-integrate flow.
Relevant files
shared/egg_contracts/dependency_graph.py— DAG and wave computation (needs phase-level nodes)shared/egg_contracts/agent_roles.py— Role definitions, especiallyINTEGRATOR_ROLE(needs write access)shared/egg_contracts/orchestration.py—can_agent_run(),get_runnable_agents()shared/egg_contracts/orchestrator.py— Dispatch logic (needs per-phase cycling)shared/egg_contracts/models.py—Task,Phase,AgentExecutionModel(needs(phase_id, role)keying)orchestrator/multi_agent.py—MultiAgentExecutorwave spawning (needs phase-level orchestration)orchestrator/dispatch.py—PipelineDispatcher(needs implement cycle loop)orchestrator/routes/pipelines.py— Refine prompt (complexity assessment), implement phase orchestration
Acceptance criteria
- Refine phase complexity assessment distinguishes three tiers (low / mid / high)
- Tier 1 (short-circuit) continues to work as-is
- Tier 2 (mid) continues to work as-is (single coder, role-level waves)
- Tier 3 (high) runs independent plan phases as parallel implement cycles, dependent phases sequentially
- Each implement cycle includes coder → tester → agentic review, with retry on rejection
- Integrator has write access and merges sub-branches, fixes integration issues
- Human review scope is bounded: integrator fixup diff + full PR sign-off (not per-phase)
- Contract state tracks per-phase-per-role execution status
- Sub-branch isolation prevents merge conflicts between parallel phases
Activity
[-]Support parallel task-level dispatch for coders and testers[/-][+]Support parallel phase-level dispatch for implement phase[/+]Initialize SDLC contract for issue #732
Add analysis for issue #732: parallel phase-level dispatch
Add agent-design review verdict for issue #732 refine phase
Add refine review verdict for issue #732
Add architect analysis for Tier 3 phase-level dispatch (#732)
Add task planner implementation plan for Tier 3 phase-level dispatch (#…
Add risk assessment for Tier 3 phase-level dispatch (#732)
Add plan review verdict for #732
Add code review verdict for #732 implement phase
Add contract review verdict for #732 implement phase
Add Tier 3 parallel phase-level dispatch (#812)
refine: revise #2137 analysis per reviewer_refine NACK