[Bug]: Compile Shuffle embedding batches have no failure isolation or checkpoint; 113 rate-limited batches abort a 10.5h task
Issue Origin
Observed or reproduced in a real environment
Bug Description
Compile's Shuffle embedding stage has no per-batch failure isolation and no stage checkpoint. A short burst of provider 429s permanently aborts a task that has already spent hours in Map, and the retained Map results cannot be reused because no resume path exists.
In a full-corpus run (871 papers, 9,570 source ranges):
- Map completed: 10,417 records, 6,711 routing embeddings, 9,477 validated LLM cache entries.
- Shuffle then issued
POST /api/v1/compile/embeddings333 times: 220 returned 200, 113 returned 429 (code 11202 requests per second limit exceeded). vikingbot/compile/ops/shuffle.pycallsbounded_jobs(...)for those batches without afailuressink;pipeline_io.pyaggregates all failures and raisesValueError("113 pipeline jobs failed: ...").- The whole task ended
COMPILE_INCOMPLETEafter 37,739.9 seconds (10h29m), published 0 pages, androutes//groups/were never created.
This is not an LLM-routing failure: the failure happens before routing, in the routing-embedding batches. The already-computed 6,711 vectors are on disk but there is no way to continue from them.
Steps to Reproduce
- Build a Compile task large enough that Shuffle needs more than a few hundred embedding batches (e.g. 8k+ records).
- Use an embedding provider with an RPS quota (observed with an OpenAI-compatible MaaS endpoint).
- Run the task; observe 429 responses in
/api/v1/compile/embeddings. - After 3 retry attempts in
RetryEmbedder, batches fail;bounded_jobsraises and the entire task is marked failed.
Expected Behavior
- A failed embedding batch should be retried with pacing/backoff and isolated (failures sink), not abort every other Shuffle batch.
- At minimum, Shuffle should persist per-batch success and allow continuation from the remaining batches on restart (stage checkpoint / resumable job state).
- The task should report which batches failed and which vectors were persisted, instead of a single aggregated
COMPILE_INCOMPLETE.
Actual Behavior
- 113 failed batches abort the whole Shuffle stage.
- All completed Map records and embeddings remain stranded in the task workspace.
- The task error only contains four repeated messages (
... pipeline jobs failed: ['Upstream model quota or rate limit exceeded (HTTP 429): requests per second limit exceeded', ...]).
Minimal Reproducible Example
# Shape of the observed failure (vikingbot/compile/ops/shuffle.py, Shuffle.vectors)
await bounded_jobs(
(missing[start : start + 32] for start in range(0, len(missing), 32)),
embed,
concurrency=r.limits.shuffle_concurrency,
metrics=r.metrics,
# no failures=r.failures here: first failing batch escalates to a task-level error
)
Error Logs
task_id = cmp_ec6ca6092412ad46a33d2d0a2357b3cf586362f5209ea4d7bdb453ca8350b2e9
status = failed
stage = failed
processing_s = 37739.94
error = COMPILE_INCOMPLETE: 113 pipeline jobs failed:
['Upstream model quota or rate limit exceeded (HTTP 429): requests per second limit exceeded', ...]
/api/v1/compile/embeddings: 220 x HTTP 200, 113 x HTTP 429
first 429 at 2026-10-20 10:22:02.980 (local), retry 1/3 at 10:21:55.017
provider body: {"error": {"code": 11202, "message": "requests per second limit exceeded",
"type": "rate_limit_error"}}
OpenViking Version
0.5.1
Python Version
3.12 (uv tool environment)
Operating System
Windows
Model Backend
Other
Additional Context
Relevant code:
bot/vikingbot/compile/ops/shuffle.py(Shuffle.vectors,bounded_jobswithout failures sink)bot/vikingbot/compile/pipeline_io.py(bounded_jobs, aggregatedValueError)bot/vikingbot/compile/pipeline_io.py(RetryEmbedderfixed backoff, no global request budget)
Related: #4765 (shared retry helpers ignore Retry-After). The embedding endpoint also processes at most 32 texts per request and internally runs groups of 4, so client-side job concurrency (shuffle_concurrency) is not an upstream RPS limit — pacing must be based on actual upstream calls.
A practical workaround used here: run a copy of the task workspace with a local driver, pace /compile/embeddings at roughly one 32-text request every 8–12 seconds, and persist every vector; this completed the missing 3,616 vectors without a single 429. That workaround is not a substitute for in-product recovery.
Related recovery gap tracked in #6369; related retry helper issue: #4765.
Thanks for sharing the batch counts and the 429 logs. On current main, if the embedding provider rate-limits a batch during Shuffle, Compile falls back to ranking candidates by text overlap so routing can continue. The run records a warning because text matching may miss related documents. Shuffle also reuses cached vectors for matching text and model, and skips batches that have not yet started once an embedding request fails. Shuffle implementation · Routing fallback
I'm closing this issue for the reported Shuffle failure. Please pull the latest main and try your corpus again. If a 429 still aborts the run, please comment here with the commit and the Shuffle error so we can follow up. The separate request to resume an interrupted run is tracked in #6369.