{"slug": "how-to-test-ai-provider-timeouts-before-production", "title": "How to Test AI Provider Timeouts Before Production", "summary": "A developer outlined a testing approach for AI provider timeouts that uses a stub provider to simulate delayed responses, HTTP 429 rate limits, malformed output and duplicate job IDs before production deployment. The method pairs per-feature deadlines with stable job IDs carried through the queue and persistence layer, so retries and duplicate processing yield a single user-visible result, and logs request IDs and timing without storing full prompts.", "body_md": "*Disclosure: This article was drafted with AI assistance.*\n\nWhen an application depends on an AI provider, write down what your app should do when the provider times out before you wire up retries. Otherwise, a slow request can tie up a worker and a retry can accidentally start the same job twice.\n\nStart with the time a user can reasonably wait for the feature. If a page has a five-second budget, the model call needs a shorter deadline so the app has time to return a useful response. If the work routinely takes longer, give the user a job ID and show its status instead of holding the page open.\n\nUse a stub provider in your test environment. Make it return the same outcomes your integration handles in production:\n\n| Stub response | What to check | \n|---|---|\n| Delayed response | The app reaches its deadline and returns the intended fallback. | \n| HTTP 429 | Retries stay within the deadline and respect the provider’s retry guidance. | \n| Malformed response | Validation fails and the app does not store a partial result. | \n| Duplicate job ID | The same job does not produce a second user-visible result. | \n\nFor operations with side effects, carry a stable job ID through the queue and persistence layer. Test that processing the same job twice leaves a single result. Keep request IDs and timing in the logs so you can trace failures without storing the full prompt.\n\nFor related reading on cloud infrastructure and AI, see my [GlobalDXB technology blog](https://www.globaldxb.com/).", "url": "https://wpnews.pro/news/how-to-test-ai-provider-timeouts-before-production", "canonical_source": "https://dev.to/tek_uae_0be01409d814110ee/how-to-test-ai-provider-timeouts-before-production-dc6", "published_at": "2026-11-27 10:12:30+00:00", "updated_at": "2026-11-27 10:15:18.395987+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "mlops", "ai-infrastructure"], "entities": [], "also_reported_by": [], "takeaway": "Simulate delayed responses, HTTP 429s, malformed output and duplicate job IDs with a stub provider, and carry a stable job ID through the queue and persistence layer so processing the same job twice leaves one result.", "recommendation": {"advice": "Test timeout, 429, malformed-response and duplicate-job cases against a stub provider before production, and key side-effecting work on a stable job ID so retries never produce a second result.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/how-to-test-ai-provider-timeouts-before-production", "markdown": "https://wpnews.pro/news/how-to-test-ai-provider-timeouts-before-production.md", "text": "https://wpnews.pro/news/how-to-test-ai-provider-timeouts-before-production.txt", "jsonld": "https://wpnews.pro/news/how-to-test-ai-provider-timeouts-before-production.jsonld"}}