agora.fleet.phase_gate
Phase grouping + gate evaluation for the phase-staged runner (integration run 1).
A run-1 flow tags each task with a phase (e.g. "P3"). The runner executes
phases in DECLARED order and pauses at each boundary (the staged-pause discipline
from scripts/run_sweep_staged.py, applied to phases within one run). A phase’s
GATE is green iff every BLOCKING task in the phase had all its postconditions
pass; non-blocking tasks (verifiers) are recorded but never gate (the blocking
distinction pairs with F5: a verifier is ordered after a blocking task via
order_after so it still runs at gate time even when that task failed). A red
gate stops the run before the next phase — repair happens against that boundary.
This module is pure: it turns (tasks, per-task postcondition results) into an
ordered list of PhaseGateResult. The live runner supplies the results
(from postcondition evaluation) and consults first_red_phase() to decide
whether to advance. Provenance is emitted via PhaseGateRecord
(see agora.observe.jsonl). The MECHANICAL gate re-eval that repair uses
(scripts/run_phased.py:reevaluate_phase_gate — F17b persists its captures,
F23 makes same-phase repair re-check the whole gate) re-runs these same
postconditions over the workspace and feeds the results straight back here.
Functions
|
Compute one phase's gate from its tasks' postcondition outcomes. |
|
Return the phase name of the first red gate in order, else None. |
|
Map phase → tasks (declared order preserved within each phase). |
|
Phases in first-seen (declared) order. |
|
Given results so far and the full declared phase |
Classes
The gate outcome for one phase. |
|
One task's contribution to its phase gate. |
- class agora.fleet.phase_gate.PhaseGateResult[source]
Bases:
objectThe gate outcome for one phase.
passedis True iff every BLOCKING task passed.blockersnames the blocking tasks that failed (empty when green). Non-blocking task outcomes are retained intasksfor provenance but excluded from the verdict.- tasks: tuple[TaskGateOutcome, ...]
- mechanical: bool = False
True when produced by a mechanical re-evaluation over the workspace (cross-phase repair) rather than a live task run — read as an ARTIFACT-STATE check, its genuine signal being run_check re-execution.
- property blocking_tasks: tuple[TaskGateOutcome, ...]
- property nonblocking_tasks: tuple[TaskGateOutcome, ...]
- __init__(phase, tasks, passed, blockers, mechanical=False)
- class agora.fleet.phase_gate.TaskGateOutcome[source]
Bases:
objectOne task’s contribution to its phase gate.
- __init__(task_id, blocking, postconditions=<factory>)
- agora.fleet.phase_gate.evaluate_phase_gate(phase, outcomes)[source]
Compute one phase’s gate from its tasks’ postcondition outcomes.
Green iff every BLOCKING task passed. Non-blocking tasks never gate.
- agora.fleet.phase_gate.first_red_phase(results)[source]
Return the phase name of the first red gate in order, else None.
The staged runner stops before the phase AFTER this one — a red gate blocks every downstream phase until repair turns it green.
- agora.fleet.phase_gate.group_tasks_by_phase(tasks)[source]
Map phase → tasks (declared order preserved within each phase).