Context
Two parallel pipeline systems exist in the codebase:
src/apprentice/core/pipeline.py — defines PipelineConfig with explicit gate ordering and _evaluate_gates() that runs post-stage gates and halts on blocking failures.
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.
Context
Two parallel pipeline systems exist in the codebase:
src/apprentice/core/pipeline.py— definesPipelineConfigwith explicit gate ordering and_evaluate_gates()that runs post-stage gates and halts on blocking failures.src/apprentice/core/orchestrator.py— builds the production ADK pipeline usingSequentialAgent/ParallelAgent/LoopAgent. This is what the CLI actually invokes (cli.py:152callsbuild_pipeline()).PipelineConfiggates 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
src/apprentice/gates/(correctness.py:23,schema_compliance.py:134,consistency.py:51,lint.py:65) do not actually block in the live pipeline.Proposed fix
Unify the two systems. Recommended direction: make the ADK orchestrator respect
PipelineConfig.gatesby inserting gate evaluation asBaseAgentsubclasses between stage agents in theSequentialAgentchain.Sketch:
GateAgentruns thesrc/apprentice/gates/<name>.pyblocking check, halts the pipeline on failure, and records the gate verdict into session state (see related issue on per-stage observability).Acceptance
apprentice buildon an algorithm that fails correctness (e.g., import error in generated code) halts at the correctness gate, not during packaging or later.