Ship it · Project 1

Make it
ship: gateway.py

Fix the real file until every test passes. The tests run in your browser, so nothing you type leaves this page.

Project 1 · Resilient Gateway

Northwind's risk report calls the LLM gateway through this client. On a bad day it freezes, loops forever and double-sends work. Fix it until every test passes. Everything you need is in the five parts you built.

0 of 5 parts built. The tests check the same ideas.

What the tests check

  1. ·Returns the answer on a 200
  2. ·Every call sets a timeout
  3. ·Retries after a timeout
  4. ·Retries a 429 and waits as long as Retry-After says
  5. ·Never retries a 400 or a 401
  6. ·Gives up after max_attempts
  7. ·Reuses one idempotency key across retries
  8. ·Logs one searchable line when it gives up
gateway.py
First load takes a few seconds.