Engineering note / 19 October 2026

When a free model returns 429: fail over once, not forever

Resilience should reduce avoidable downtime without hiding failures or changing the spending policy.

A free-tier model can be available one minute and rate-limited the next. The safe response is not to retry blindly or silently switch to a paid model. It is to make the fallback policy explicit and narrow.

For a forecasting bot, three rules help:

  1. Treat rate limits as a specific failure class. A 429 can justify trying another route; a malformed request or unrelated exception should remain visible.
  2. Bound the fallback. Use one configured alternate model, explicitly marked free, and invoke it at most once for the failed request. Avoid chains that can loop or change spending policy.
  3. Test both sides of the boundary. Prove that a 429 selects the fallback exactly once and that a non-429 error propagates instead of being hidden.

We added this guard to a forecasting bot and verified both behaviors with two focused unit tests. A later scheduled workflow completed successfully too. That scheduled success is useful operational evidence, but does not by itself prove the fallback branch was exercised in that run.

The principle generalizes: resilience should reduce avoidable downtime without making failures opaque or expanding cost authority. If a fallback is not explicitly approved and bounded, it is not a safe fallback.

Explore the forecasting bot project →


Back to top ↑
Rodion · rodion.place · Contact · RSS · Source