By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
In step 15 the evaluation harness ran in seconds against a small golden set, inside CI, and that was the right shape. The harness has grown up: four hundred golden cases, three candidate snapshots per release, an LLM-judge rubric for the open-ended answers, and a nightly shadow evaluation over sampled production traffic. Doing all of that inside a deploy makes the gate slow and flaky. Doing it inside a request is impossible.
The resolution is not to make the gate asynchronous. It is to split two responsibilities that were sharing a function: execution becomes queue-backed work, and the gate stays a synchronous check that reads a recorded result for the exact candidate it is about to promote. The release still blocks until evidence exists. What changes is where the evidence is produced and how long a worker may spend producing it.
| Work | Trigger | Execution shape | Blocks a release? |
|---|---|---|---|
| Release-candidate evaluation | The CI gate | Queue job, awaited by the gate | Yes — the gate waits for this fingerprint |
| Nightly regression suite | Scheduled | Queue job, no waiter | No, but it feeds the weekly review and the gate history |
| Judge scoring backlog | New cases or rubric version | Batched queue job | No, until a release claims the result |
| Shadow evaluation of sampled traffic | Live traffic sample | Streaming workers | No; it changes the quality signal, not the release |
| Approvals and chargeable actions | A human decision | Never queued for later | Always inline, always recorded |
The rule behind the table: anything that removes a customer action or spends money as the result of a decision stays inline and recorded. Anything that produces evidence may be asynchronous, on one condition: the result must be addressable by a fingerprint that identifies exactly what was evaluated. A green result for a different prompt version or a different snapshot is not evidence for this release.
A queue job is a small, durable record, not a Python closure. Give it an identity and enough context that a worker from any host can finish it: the job ID, the candidate fingerprint (prompt version, model snapshot, suite version, config hash), the attempt counter, a lease deadline, a budget cap for the run, and a pointer to where the result will be written. Enqueue is idempotent on the fingerprint, so a release pipeline that fires twice does not pay for the suite twice.
Delivery is at-least-once. A worker can finish the run and die before acknowledging it, so the worker must be idempotent too: write the result under a key derived from the fingerprint, then acknowledge. A stale lease is requeued with the same job ID, which keeps the status contract stable. After the attempt cap the job moves to a dead-letter queue with its last error, and it stays visible to the release gate as a failure rather than disappearing.
from dataclasses import dataclass
MAX_ATTEMPTS = 2
@dataclass
class EvalJob:
job_id: str
fingerprint: str
attempts: int = 0
state: str = "queued"
class FakeQueue:
"""In-memory stand-in for the real queue: at-least-once with dedupe."""
def __init__(self) -> None:
self.messages: list[EvalJob] = []
self.in_flight: set[str] = set()
self.results: dict[str, str] = {}
def enqueue(self, job: EvalJob) -> str:
if job.fingerprint in self.in_flight or job.fingerprint in self.results:
return "deduped"
self.in_flight.add(job.fingerprint)
self.messages.append(job)
return "enqueued"
def deliver(self) -> EvalJob:
job = self.messages.pop(0)
job.state = "running"
return job
def fail(self, job: EvalJob) -> None:
job.attempts += 1
if job.attempts >= MAX_ATTEMPTS:
job.state = "dead"
self.results[job.fingerprint] = "dead"
else:
job.state = "queued"
self.messages.append(job)
queue = FakeQueue()
first = EvalJob("eval-001", "wp-update@v8|golden@v5")
log = [queue.enqueue(first)]
log.append(queue.enqueue(EvalJob("eval-002", first.fingerprint)))
for attempt in range(1, MAX_ATTEMPTS + 1):
job = queue.deliver()
queue.fail(job)
log.append(f"attempt-{attempt}:{job.state}")
print(log)
print(queue.results)Async work needs a status surface that a release pipeline, a dashboard and a human can all read. POST /eval-runs returns 202 with the job ID and the fingerprint. GET /eval-runs/{job_id} returns a state from a closed set — queued, running, succeeded, failed, dead — plus case progress and partial results. A cancelled job keeps its record and reports the partial result it had at cancellation; job records are audit data and are never deleted when the run ends.
A dead job is not a missing job. The gate must see dead and hold the release with a clear reason; it must never interpret the absence of a result as a pass. This is the single most common way an asynchronous gate quietly stops existing.
Evaluation spends real money, so it gets its own budget line and its own guards. Cap cases per run, cap judge calls per case, and give evaluation a daily budget separate from tenant budgets so a busy release day cannot starve customers. Cache only deterministic checks; caching judge verdicts across candidate fingerprints hides instability. Alert on queue depth and on the age of the oldest queued job, not only on worker CPU.
Key takeaways
Split evaluation execution from the release gate: workers may run asynchronously, but promotion stays blocked until a recorded result exists for the exact candidate fingerprint.
Give every eval job an envelope with a fingerprint, attempt count, lease, budget cap and result pointer; enqueue and result writes are idempotent.
Delivery is at-least-once, so workers write results under the fingerprint and acknowledge afterwards; stale leases requeue with the same job ID.
Expose a closed status set with progress and partial results, keep job records for audit, and treat a dead job as a failed gate rather than a missing one.
Give evaluation its own budget and capacity alerts, and cache only deterministic checks rather than judge verdicts.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.