Quanta

← Back to Briefings

One Job ID Across a Team’s Generation Retries

Team playbooksEN14 reads

01 · A timeout can leave the generation running

Your team submits a long generation, waits for the response, and hits a timeout. A worker retries. Meanwhile, the first request may still be generating tokens. What looked like recovery can become two billable generations, two competing answers, and two attempts to update the same downstream system.

For teams running heavy workloads, this is a coordination problem with budget consequences. The objective is to make repeated attempts represent one logical job, while recognizing that a disconnected client cannot always determine what happened upstream.

02 · Give each logical job one durable identity

Idempotency means repeating an operation preserves the intended effect. It does not mean a model will produce identical text twice. Even matching prompts and settings do not establish that two generations are the same execution.

Create a job ID before dispatch and store it durably. Every retry for that job should carry the same identity. A deliberate request for another answer gets a new identity, even when the prompt is unchanged.

Associate that identity with a fingerprint of the effective request: model, messages, generation settings, tool definitions, and relevant input versions. If an existing job ID arrives with a different fingerprint, reject the conflict. Otherwise, an application bug could return an old answer for a changed task.

03 · Use a ledger to coordinate workers and results

A shared database record should track the job’s state, request fingerprint, attempt history, and stored result. Use an atomic insert or claim operation so simultaneous workers cannot both acquire a fresh job.

  • › Queued: the job exists and awaits dispatch.
  • › Running: a worker owns the current attempt, with a lease and heartbeat.
  • › Unknown: dispatch may have succeeded, but completion cannot be confirmed.
  • › Completed: the result is durably stored and can be returned again.
  • › Failed: a known outcome requires classification before another attempt.

A lease prevents abandoned ownership from lasting forever. Its expiration does not prove that an upstream generation stopped. Another worker must examine the attempt’s status before sending a replacement.

04 · Separate local deduplication from upstream guarantees

Your ledger can suppress duplicate submissions within your application. It cannot, by itself, guarantee exactly one upstream execution. A worker can crash after dispatch but before recording that dispatch succeeded.

If the endpoint explicitly supports idempotency keys, reuse the key according to its documented scope, retention period, and request-matching rules. Do not assume that an arbitrary header provides deduplication, or that support is identical across models and routes.

When available, retain an upstream request or operation identifier and use a supported status or result lookup. If neither lookup nor upstream deduplication exists, an ambiguous timeout requires a policy decision: wait, investigate, or authorize another potentially billable attempt. Unknown is a real operational state.

05 · Set retry limits around deadlines and uncertainty

Classify failures before retrying. A connection failure known to occur before submission differs from a disconnect after generation begins. Rate limits and temporary service errors may justify delayed retries; invalid inputs generally require correction. Follow documented retry guidance and respect any retry delay supplied by the service.

Apply exponential backoff with jitter, an attempt cap, and an overall job deadline. Coordinate SDK, worker, and queue retry settings so their attempts do not multiply unexpectedly. Under sustained load, uncontrolled retries consume concurrency precisely when capacity is already constrained.

06 · Keep streaming recovery and spending visible

Persist stream progress when useful, but do not treat partial output as a completed result. Unless the endpoint supports resuming the same operation, a new request starts another generation. Publish final results through a conditional state transition, and give downstream actions their own deduplication keys.

Quanta is a practical fit for teams consolidating sustained model workloads under one pay-as-you-go balance, including requests to Claude Sonnet 5.5 or GPT-6 Astra. Every call is metered on real tokens, with cache writes and cache reads priced separately. Account for those categories when reviewing retry costs; cached input does not make duplicate generation free.

Open a Quanta account to consolidate that usage, and keep the retry ledger in your application’s operational design. Before broad rollout, test simultaneous submissions, worker crashes after dispatch, and broken streams. Track attempts per job, ambiguous outcomes, and token spend so leads can see whether recovery is preserving both throughput and budget.