Skip to content

orchestration: wire gates/ into core/orchestrator.py ADK pipeline #15

@Mathews-Tom

Description

@Mathews-Tom

Context

Two parallel pipeline systems exist in the codebase:

  1. src/apprentice/core/pipeline.py — defines PipelineConfig with explicit gate ordering and _evaluate_gates() that runs post-stage gates and halts on blocking failures.
  2. src/apprentice/core/orchestrator.py — builds the production ADK pipeline using SequentialAgent / ParallelAgent / LoopAgent. This is what the CLI actually invokes (cli.py:152 calls build_pipeline()).

PipelineConfig gates are NOT used by the ADK orchestrator. Correctness checking currently happens inside the implementation agent's self-review loop via LLM tool calls, not as a deterministic post-stage gate.

Impact

  • The design-review requirement "correctness gate must run before artifact generation to fail fast" is unmet.
  • Blocking gates defined in src/apprentice/gates/ (correctness.py:23, schema_compliance.py:134, consistency.py:51, lint.py:65) do not actually block in the live pipeline.
  • Gate ordering decisions in config have no runtime effect.

Proposed fix

Unify the two systems. Recommended direction: make the ADK orchestrator respect PipelineConfig.gates by inserting gate evaluation as BaseAgent subclasses between stage agents in the SequentialAgent chain.

Sketch:

# core/orchestrator.py
def build_pipeline(config):
    stages = [implementation_agent, instrumentation_agent, ...]
    stages_with_gates = []
    for stage in stages:
        stages_with_gates.append(stage)
        for gate_name in config.gates.get(stage.name, []):
            stages_with_gates.append(GateAgent(gate_name))
    return SequentialAgent(stages_with_gates)

GateAgent runs the src/apprentice/gates/<name>.py blocking check, halts the pipeline on failure, and records the gate verdict into session state (see related issue on per-stage observability).

Acceptance

  • apprentice build on an algorithm that fails correctness (e.g., import error in generated code) halts at the correctness gate, not during packaging or later.
  • Session JSON records gate verdicts in order of execution.
  • Integration test reports which gates ran and their outcomes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions