A router that only works when the primary model works is not a router: it is a single point of failure with extra steps. The fallback must be tested by breaking the primary on purpose, in a safe environment, and watching what happens next. The checks are whether the fallback model answers, whether the user sees a clean result, and whether the failure is logged.
Before you start
A routing setup with a primary and a fallback model, and a test environment where you can block the primary safely.
List the failure modes to test
Write down the failures the router must handle: the primary model returns an error, it times out, it returns an empty reply, and it is rate-limited with a 429. A failure you have not listed is a failure you have not tested.
For each mode, write what the router should do: retry once, then fall back, or fall back immediately.
Break the primary on purpose
In the test environment, block the primary model or point it at a bad key, then send one request per failure mode. Do not test the fallback by hoping the primary fails in production.
Send a normal request too, and confirm it still uses the primary: a router that always falls back is as broken as one that never does.
Check the fallback answer and the log
For each failure, check three things: the user got a complete answer from the fallback, the answer is marked as coming from the fallback, and the failure is logged with the model name and the error.
Count the extra cost: a fallback that retries the primary three times before switching costs more than one that switches after one retry.
Practice check: fictional Maple Corner router, 4 failure modes
The table below is fictional practice material, worked out by hand from the stated failure modes. It is the expected result for the practice router, not a run of any system.
| Failure mode | Router action | User sees | Verdict |
|---|---|---|---|
| Primary error 500 | Fallback after 1 retry | Complete answer | Pass |
| Primary timeout | Fallback after 1 retry | Complete answer | Pass |
| Primary 429 rate limit | Wait, then fallback | Complete answer | Pass |
| Empty reply | Fallback immediately | Complete answer | Pass |
All four failure modes end in a complete answer from the fallback, with one retry at most. The router is tested, not assumed.
Expected result. UNTESTED: the outcomes in the practice table are worked out by hand, not measured by running a router. Break your own primary model on purpose in a test environment, send one request per failure mode, and check the fallback answer and the log.
Limits
- A fallback that is never tested is a fallback that fails when you need it: test it on a schedule, not once.
- Falling back to a weaker model can change answer quality: check the fallback’s answers, not just that it answered.
