Skip to main content

Module router

Module router 

Source
Expand description

The enforce-mode escalation engine (SPEC §7.1) — the crown jewel.

Cheapest rung first: call the model, gate the output, serve the first output that passes; escalate exactly one rung on gate failure, up to a ladder/budget/max_rungs ceiling. A failover-eligible provider error (transport / 5xx) abstains and moves to the next rung — so cross-provider failover falls out of the same loop (§7.2). This is the real-typed, async version of the Firstpass policy proven in firstpass-bench; the semantics are identical.

Structs§

EnforceCtx
Everything the engine needs for one decision. Borrowed to avoid cloning the ladder/request per call; owned trace-context strings so the resulting Trace is self-contained.

Enums§

EngineOutcome
The outcome of an enforce-mode routing decision.

Functions§

route_enforce
Run the enforce-mode ladder and produce both the outcome and its audit trace.