Skip to content
James Ross
articlePublished Updated 8 min read

LLM failover that actually fails over: two hops, wall-clock aborts and empty completions

By James Ross

LLM failover is three separate mechanisms, and most implementations build only the first. Retrying a request is one. Falling back to a second provider is two. Bounding the whole operation with a deadline and treating an empty response as a failure is three. Without the third, a system can have a healthy retry policy, a configured fallback, and a request that hangs for nine minutes and then returns nothing.

A request rerouting from a stopwatch-ringed primary server over a bridge to a backup, depicting LLM failover with wall-clock aborts.

This is the failure story behind the company AI workspace rollout, from an internal timecard assistant that summarises a week of calendar, email and chat activity into billable entries. It is also the clearest example of the difference between a request timeout and a wall-clock budget.

What failover has to do

Failover has to answer one question: what is the largest amount of time this operation is allowed to cost, and what happens when that budget runs out? A retry policy answers a narrower question, which is what to do about one failed request.

Those are not the same thing. A retry loop that runs three attempts per provider, across two providers, with a 60-second timeout each, has a worst case of six minutes before it returns anything. Add a client that gives up at 90 seconds and the work is wasted: the caller is gone, the model still runs, and the bill still arrives.

The assistant’s chain had two hops. The primary was a hosted model endpoint. The fallback was a second provider reached through the same client interface. That part was ordinary. What was missing was a budget around the whole thing.

Two hops, two error classes

The first design decision is which errors may cross a hop. Not all of them should.

Error class Examples Correct action
Caller error 400 malformed request, 401 bad credential, 422 schema violation Fail immediately, do not retry, do not fall back
Transient capacity 429 rate limit, 502 upstream error, 504 upstream timeout, network reset Retry once, then fall back
Content failure 200 with an empty or truncated completion Treat as a failed attempt and fall back
Permanent upstream Repeated 503 after the retry budget Return a real error with the provider named in the log

The first row matters most. A 400 sent to a second provider will fail again and wastes budget a real request might need. The bridge client encodes this as a property on the error: transient or not. The caller asks whether the failure is worth another hop, not what the status code was.

The last row is where failover systems quietly lie. If both providers are down, the honest answer is a 503 with a message that says so. A cached or empty response turns an outage into a data-quality incident.

Request timeout versus wall-clock deadline

A request timeout bounds one attempt. A wall-clock deadline bounds the operation. The difference only shows up when retries and fallbacks multiply, which is exactly when it matters.

The timecard assistant had both, in the end. Each model call gets an AbortSignal with its own timeout, so a stalled socket cannot hold a request forever. The summarise operation also gets a single deadline computed at the start, and every hop checks the remaining budget before it begins. If the remaining budget is smaller than a sensible minimum, the operation fails fast instead of starting an attempt that cannot finish.

AbortSignal.timeout() returns a signal that aborts after a fixed time, which is the primitive this pattern builds on (MDN). The important design choice is where the deadline is created. Create it per attempt and the total is unbounded. Create it once per operation and pass the remaining time down, and the total is bounded by construction.

The hang that prompted this was not a slow model. The operation simply never settled, so the per-request timer had nothing to fire against. A wall-clock abort settles the operation regardless of what the socket is doing, and the error it raises is distinguishable from a provider failure: one means the deadline expired, the other means the provider failed.

Empty completions are failures with a 200

An empty completion is the most expensive kind of failure because every layer above it believes the request succeeded. The HTTP call returned 200. The JSON parsed. The message object exists. Its content is empty, or whitespace, or a truncated fragment that fails to parse as the expected structure.

The fallback in the incident did exactly this: it spent 32,000 tokens on reasoning, hit its output limit, and returned a completion with nothing usable in it. The client retried nothing, because there was no error to retry.

The fix is a content check before the response leaves the client: if the completion is empty, or the expected structured output is missing, raise a transient failure and let the chain continue. The check has to sit after parsing and before the caller, and it has to be specific about what “usable” means for that call. For a JSON-schema response, usable means the schema validated. For prose, it means a non-empty string after trimming.

That also changes the retry accounting. An empty completion is a consumed attempt and a consumed budget, not a free retry.

The 9.5-minute incident

The failing request was one week of activity in one prompt. It carried 85,478 characters: five days of calendar events, sent email and 802 Teams messages across 15 chats, three of which held 282, 256 and 110 messages.

The sequence was:

  1. The prompt went to the primary provider.
  2. The primary returned 503.
  3. The chain fell back to a second provider and a reasoning model.
  4. That model spent 32,000 tokens on hidden reasoning, hit its completion limit, and returned an empty result.
  5. Nothing treated the empty result as a failure, so nothing retried.
  6. The browser waited. At 9.5 minutes the reverse proxy recorded a client-closed request and the user got nothing.

Every mechanism looked reasonable: a retry, a fallback, a per-request timeout. What did not exist was a budget for the operation, a check for empty content, or a way to tell the user the work was still running.

There is a second lesson in the same log. Even if the fallback had returned a valid completion, a single call over 85,000 characters was the wrong unit of work. It burned 21,000-plus completion tokens in earlier attempts and often produced nothing usable. The failure was not only in the failover; it was in the request.

Chunking changed the failure unit

The fix that made the biggest difference was not in the failover logic. It was splitting the week.

Long chats are condensed first: any chat above a message threshold gets its own call that returns a short structured summary of topics, decisions, likely client and rough engagement. Then each day gets one call with its calendar, email and condensed chats. A day that still exceeds a character cap is split by chat, never mid-chat.

The same week became 15 calls: 10 condensation calls and 5 day calls, each around 15,000 to 18,000 characters. The reduce step is code, not another model call: concatenate, sort by date, merge rows with the same date, client and source, sum the hours and keep the weakest confidence.

That changes what a failure means. One failed day call now fails one day, with a message naming it, instead of failing the week. A failed condensation does not fail the run at all; the raw chat is kept and the day call sees the transcript. And the fixed overhead becomes the new constraint: at roughly 12,000 tokens and 3 seconds per call, 15 calls cost real money and real time, so the split granularity is a deliberate trade between reliability and overhead.

Make the wait visible

A long operation with no progress is indistinguishable from a hang. The assistant moved from a blocking request to a job: the summarise route returns 202 with a job id, and the client polls a status route every three seconds and shows the stage.

The job is bound to the session that created it. A poll from another session gets a 404, not a 403, because a 403 confirms the job exists. The in-memory store is capped and swept on a timer, and the client treats a 404 mid-poll as “the server restarted, try again” rather than waiting forever.

This is the cheapest reliability feature in the whole system, and it does not improve the model at all. It converts an invisible wait into a progress indicator and a bounded failure into a retryable one.

Per-request retry vs wall-clock budget vs job with a deadline

Approach What is bounded Worst case Caller experience When it fits
Retry per request One attempt attempts × timeout × hops Waits, then gets an error or a result Short, cheap calls
Wall-clock budget The whole operation The budget Fails predictably at the budget Any call with more than one hop
Job with a deadline and polling The operation, plus visibility The budget, with progress Sees stages, can retry deliberately Work measured in minutes

Which should you choose? Use a per-request timeout everywhere, because a socket that never closes is a real failure mode. Add a wall-clock budget as soon as there is more than one attempt or more than one provider, because that is when the worst case stops being obvious. Add the job shape when the work can exceed a client’s patience, which for a week of activity summarisation it does.

What broke and what we changed

A hang that no timeout caught. The stream stayed open after the server finished, so the per-request timer never fired. A wall-clock abort around the operation fixed it, and the resulting error is now labelled as a local give-up rather than a provider failure.

An empty completion counted as success. The fallback returned 200 with nothing usable and the chain stopped. The client now validates content before returning it, and an empty or unparseable completion is a transient error that continues the chain.

A silent nine-minute wait. The proxy timed out before the server did. The job API returned a job id in milliseconds and moved the long work behind a poll, which removed both the proxy timeout and the user’s uncertainty.

Frequently asked questions

What is LLM failover?

LLM failover is the practice of routing a request to another provider or model when the first one fails. Real failover needs three parts: a retry policy, a fallback path, and a deadline that bounds the whole operation so retries and fallbacks cannot multiply into an unbounded wait.

Why is a request timeout not enough?

Because it bounds one attempt, not the operation. Three retries across two providers with a 60-second timeout is a six-minute worst case even though every individual request is bounded. A wall-clock deadline created once per operation and checked before each attempt is what bounds the total.

What is an empty completion and why does it matter?

An empty completion is a successful HTTP response whose content is empty or unusable. It matters because nothing above it treats it as an error: no retry fires, the user gets nothing, and the tokens are still billed. Validate the content before returning it, and classify a failed validation as a transient error.

How do you decide whether to retry or fall back?

Classify the error first. Caller errors such as 400, 401 and schema violations should fail immediately. Transient errors such as 429, 502, 504 and network resets should retry once and then fall back. Content failures should fall back. If both providers are unavailable, return an honest 503 rather than an empty result.

How long should an LLM request be allowed to run?

Long enough for a legitimate attempt and short enough that the caller still cares. For an interactive assistant that is tens of seconds, not minutes. The rule matters more than the number: one budget for the operation, checked before each hop, with a fast failure when the remaining time is too small.

Why split a large prompt into several calls?

Because a large prompt fails badly: it is slow, it can hit completion limits, and when it fails you learn nothing about which part broke. Splitting by day and condensing long chats makes each failure local, makes output verifiable, and lets the reduce step run in code. The cost is fixed per-call overhead, which sets a floor on how fine the split should be.