Skip to content

Support parallel phase-level dispatch for implement phase #732

Closed

Description

@james-in-a-box

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:

  1. Bounded reviewer scope — each agentic review covers one phase's changes, not the full feature diff
  2. Early abort — if Phase 1's agentic review finds a design flaw, we stop before burning tokens on later phases
  3. Natural dependency ordering — the plan's phase dependency graph is already the right abstraction
  4. 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_affected provides 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

  1. 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.

  2. 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.

  3. Phase-level dependency graph — DependencyGraph operates 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.

  4. Per-phase agent execution tracking — agent_executions keyed by (phase_id, role) instead of just role. The PhaseAgentConfig model already supports per-phase overrides, but execution tracking doesn't.

  5. 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.

  6. Per-phase sub-branches — Each implement cycle pushes to egg/<feature>/phase-N. The integrator merges these into egg/<feature>. Gateway needs to allow push to phase sub-branches.

  7. 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.

  8. New pipeline stage — Either a new PipelinePhase.INTEGRATE between IMPLEMENT and PR, 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, especially INTEGRATOR_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 — MultiAgentExecutor wave 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

  1. Refine phase complexity assessment distinguishes three tiers (low / mid / high)
  2. Tier 1 (short-circuit) continues to work as-is
  3. Tier 2 (mid) continues to work as-is (single coder, role-level waves)
  4. Tier 3 (high) runs independent plan phases as parallel implement cycles, dependent phases sequentially
  5. Each implement cycle includes coder → tester → agentic review, with retry on rejection
  6. Integrator has write access and merges sub-branches, fixes integration issues
  7. Human review scope is bounded: integrator fixup diff + full PR sign-off (not per-phase)
  8. Contract state tracks per-phase-per-role execution status
  9. Sub-branch isolation prevents merge conflicts between parallel phases

Activity

  1. added
    enhancement
    on Feb 15, 2026
  2. changed the title [-]Support parallel task-level dispatch for coders and testers[/-] [+]Support parallel phase-level dispatch for implement phase[/+] on Feb 17, 2026
  3. added a commit that references this issue on Apr 27, 2026
    f9de3ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions