scripts/adaptive_router.py — deterministic-first route selection. Route by uncertainty and risk, not "bug vs feature".
Routes:
LOCAL_FIX: all conditions met (reproducible, owned, testable, narrow, reversible) + zero risk/uncertainty → skip research entirely. Measured B1-v2 evidence: 384s wasted on research that found nothing.
RESEARCHED_CHANGE: any risk or uncertainty trigger → the full ratified research pipeline. Measured B3-v3 evidence: 4897s wall but produced real grounding evidence, 7 classified candidates, 21 adversarial attacks, 18 invariants, and a PROCEED verdict.
Key design decisions:
Deterministic-first (no heavyweight triage LLM)
RouteDecision dataclass with full auditability (reasons, risk_flags, uncertainty_flags, escalation_conditions, downgrade_conditions, confidence, decided_by)
Routes are reversible: escalation and downgrade are first-class
record_route_decision(): append-only JSONL for post-hoc route accuracy evaluation
Semantic arbiter reserved for future (not needed for deterministic cases)
Measured baseline comparison:
Route
Cost
Useful findings
Quality
Fixed-depth on LOCAL_FIX
384s wasted
ZERO
n/a (couldn't complete)
Fixed-depth on RESEARCHED_CHANGE
4897s total
Real grounding evidence, 21 attacks, 18 invariants
PROCEED
8 tests; 1187 suite; ruff clean.
## ADAPT-2: Canonical adaptive route authority (closes #291)
scripts/adaptive_router.py — deterministic-first route selection. Route by uncertainty and risk, not "bug vs feature".
**Routes:**
- **LOCAL_FIX**: all conditions met (reproducible, owned, testable, narrow, reversible) + zero risk/uncertainty → skip research entirely. Measured B1-v2 evidence: 384s wasted on research that found nothing.
- **STANDARD_CHANGE**: clear change, existing authority, no tech selection → bounded DESIGN-LITE. Measured B2-v2 evidence: 733s wasted.
- **RESEARCHED_CHANGE**: any risk or uncertainty trigger → the full ratified research pipeline. Measured B3-v3 evidence: 4897s wall but produced real grounding evidence, 7 classified candidates, 21 adversarial attacks, 18 invariants, and a PROCEED verdict.
**Key design decisions:**
- Deterministic-first (no heavyweight triage LLM)
- RouteDecision dataclass with full auditability (reasons, risk_flags, uncertainty_flags, escalation_conditions, downgrade_conditions, confidence, decided_by)
- Routes are reversible: escalation and downgrade are first-class
- record_route_decision(): append-only JSONL for post-hoc route accuracy evaluation
- Semantic arbiter reserved for future (not needed for deterministic cases)
**Measured baseline comparison:**
| Route | Cost | Useful findings | Quality |
|---|---|---|---|
| Fixed-depth on LOCAL_FIX | 384s wasted | ZERO | n/a (couldn't complete) |
| Fixed-depth on RESEARCHED_CHANGE | 4897s total | Real grounding evidence, 21 attacks, 18 invariants | PROCEED |
8 tests; 1187 suite; ruff clean.
scripts/adaptive_router.py:
- classify_route(): deterministic-first routing by uncertainty and risk,
NOT by 'bug vs feature'
- RouteDecision dataclass: route, reasons, risk_flags, uncertainty_flags,
escalation_conditions, downgrade_conditions, confidence, decided_by,
decided_at, task_description, baseline_sha
- LOCAL_FIX: all conditions met (reproducible, owned, testable, narrow,
reversible) + zero risk/uncertainty flags → skip research entirely
- STANDARD_CHANGE: clear change, existing authority, no tech selection →
bounded DESIGN-LITE, no external research
- RESEARCHED_CHANGE: any risk or uncertainty trigger → the full ratified
research pipeline (this is the proven path from #161/#163/#165)
- Routes are reversible: escalation and downgrade triggers are first-class
- record_route_decision(): append-only JSONL for auditability
- Semantic arbiter reserved for future use (not needed for deterministic cases)
The B3-v3 baseline (#165, 4897s wall, 12 stages, all completed) provides
the measured fixed-depth RESEARCHED_CHANGE baseline. The B1/B2 probes
provide the measured evidence that LOCAL/STANDARD work wastes 384-733s
on research stages that produce zero implementation-relevant findings.
8 tests; full suite 1187 passed; ruff clean.
🤖Headless spec gate (non-blocking, #204 first slice)
Spec-gate agent produced no text output — check runner logs.
Deterministic floors still govern the merge
This comment is advisory. Required checks (lint, tests, canaries, type-check, coverage, dependency lock, impact gate) remain the merge authority per docs/adversarial-review.md proportionality.
🤖 **Headless spec gate (non-blocking, #204 first slice)**
Spec-gate agent produced no text output — check runner logs.
<details><summary>Deterministic floors still govern the merge</summary>
This comment is advisory. Required checks (lint, tests, canaries, type-check, coverage, dependency lock, impact gate) remain the merge authority per docs/adversarial-review.md proportionality.</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
ADAPT-2: Canonical adaptive route authority (closes #291)
scripts/adaptive_router.py — deterministic-first route selection. Route by uncertainty and risk, not "bug vs feature".
Routes:
Key design decisions:
Measured baseline comparison:
8 tests; 1187 suite; ruff clean.
🤖 Headless spec gate (non-blocking, #204 first slice)
Spec-gate agent produced no text output — check runner logs.
Deterministic floors still govern the merge
This comment is advisory. Required checks (lint, tests, canaries, type-check, coverage, dependency lock, impact gate) remain the merge authority per docs/adversarial-review.md proportionality.