Finding
Files: src/router.ts:5–8, src/server.ts:598–630, src/agent-scan.ts, src/doctor.ts
decideRoute returns three Route kinds that server.ts folds into a single dispatch: ambiguous, unknown_provider, and anthropic all forward to Anthropic and set route = "anthropic". The union now encodes routing diagnoses rather than actual routing decisions. Any second consumer of decideRoute must re-implement the same fold, and the two redundant route = "anthropic" assignments at :615 and :627 (already initialised at :499) are a symptom of this.
Why Deferred
The reshape would churn doctor's taxonomy. doctor's exit code is a real CI gate (PF-006), so changing the severity discriminator between ambiguous and unknown_provider requires its own careful pass to avoid breaking the gate.
Suggested Approach
Consider replacing the three-variant union with { kind: "anthropic", diagnostic?: "ambiguous" | "unknown_provider" } so the dispatch decision and the diagnostic label are one value. server.ts dispatches on kind; doctor and logs consume diagnostic. The redundant route = "anthropic" assignments at :615/:627 become dead code and can be deleted.
Separately evaluate whether ambiguous and unknown_provider should have different doctor severities now that server.ts treats them identically.
Provenance
Deferred from code review 2026-08-19_2015 on wave/passthrough-hardening (PR #33), issue I-057 in the review ledger.
Finding
Files:
src/router.ts:5–8,src/server.ts:598–630,src/agent-scan.ts,src/doctor.tsdecideRoutereturns threeRoutekinds thatserver.tsfolds into a single dispatch:ambiguous,unknown_provider, andanthropicall forward to Anthropic and setroute = "anthropic". The union now encodes routing diagnoses rather than actual routing decisions. Any second consumer ofdecideRoutemust re-implement the same fold, and the two redundantroute = "anthropic"assignments at:615and:627(already initialised at:499) are a symptom of this.Why Deferred
The reshape would churn
doctor's taxonomy.doctor's exit code is a real CI gate (PF-006), so changing the severity discriminator betweenambiguousandunknown_providerrequires its own careful pass to avoid breaking the gate.Suggested Approach
Consider replacing the three-variant union with
{ kind: "anthropic", diagnostic?: "ambiguous" | "unknown_provider" }so the dispatch decision and the diagnostic label are one value.server.tsdispatches onkind;doctorand logs consumediagnostic. The redundantroute = "anthropic"assignments at:615/:627become dead code and can be deleted.Separately evaluate whether
ambiguousandunknown_providershould have different doctor severities now thatserver.tstreats them identically.Provenance
Deferred from code review 2026-08-19_2015 on wave/passthrough-hardening (PR #33), issue I-057 in the review ledger.