Repository navigation
Labels
area/adapter-functionsGranite adapter functions: framework and adaptiers including RAG, Guardian, Corearea/aloraLoRA/aLora adapter trainingarea/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMbugSomething isn't workingtesting
Description
Observed behaviour
Several CI runs are failing intermittently with errors like:
huggingface_hub.errors.LocalEntryNotFoundError: An error happened while trying to locate the files on the Hub and we cannot find the appropriate snapshot folder for the specified revision on the local disk. Please check your internet connection and try again.
The root cause is HuggingFace Hub returning HTTP 429 (rate limit). Because there is no retry logic or graceful degradation anywhere in the call stack, the 429 propagates as a hard error, causing test fixtures to error rather than skip and leaving production users with an unintelligible traceback.
The problem is not limited to a single call site — an audit of the codebase found it at every layer.
Affected call sites
Production code — no retry, raw error surfaces to user
| File | Line(s) | Call | Notes |
|---|---|---|---|
mellea/backends/adapters/adapter.py |
451 | snapshot_download() |
Downloads adapter index/config |
mellea/formatters/granite/intrinsics/util.py |
179 | snapshot_download() |
Downloads LoRA/aLoRA weights |
mellea/backends/huggingface.py |
298, 301 | AutoModelForCausalLM.from_pretrained(), AutoTokenizer.from_pretrained() |
Called in LocalHFBackend.__init__ on cache miss |
mellea/formatters/granite/base/util.py |
113–115 | from_pretrained() × 3 |
Downloads base model + aLoRA weights |
mellea/formatters/granite/retrievers/util.py |
47 | urlretrieve() |
Downloads MTRAG corpus from GitHub |
CLI — no retry; mid-upload 429 aborts the whole transfer
| File | Line(s) | Call |
|---|---|---|
cli/alora/upload.py |
44, 52 | create_repo(), upload_folder() |
cli/alora/intrinsic_uploader.py |
79, 109, 120 | create_repo(), upload_folder(), upload_file() |
cli/alora/commands.py |
251, 252 | create_repo(), upload_file() |
Tests — module-scoped fixtures error rather than skip, taking down the entire module
| File | Description |
|---|---|
test/stdlib/components/docs/test_richdocument.py:19–25 |
scope="module" fixture calls RichDocument.from_document_file(). Docling downloads HF layout/table models internally; a 429 errors all 4 dependent tests instead of skipping. Currently the main source of intermittent CI failures across multiple PRs. |
test/stdlib/components/intrinsic/test_core.py, test_rag.py, test_guardian.py |
Module-scoped LocalHFBackend fixtures; no skip-on-download-error. |
test/backends/test_huggingface.py, test_huggingface_tools.py, test_mellea_tool.py, test_tool_calls.py |
Same pattern. |
test/cli/test_alora_train_integration.py |
189, 206, 211 — real from_pretrained calls in integration test, no skip guard. |
Expected behaviour
- Production paths: a transient 429 or timeout should trigger a short retry with exponential backoff (3 attempts, ~2/4/8 s) before propagating the error.
- Test fixtures: if the HF Hub is unreachable or rate-limiting, module-scoped fixtures should call
pytest.skip(reason="HF unavailable — skipping", allow_module_level=True)rather than erroring. The skip pattern is already used for Ollama and Watsonx fixtures in this codebase; this brings HF-dependent fixtures in line.
Not in scope
Retry/resilience for OpenAI and Bedrock backends is already handled by the OpenAI SDK's default max_retries. Ollama server-probe fixtures already use try/except + pytest.skip. The test_intrinsics_formatters.py HfApi call already degrades gracefully.
Related
- PR fix(intrinsics): pin catalogue entries to HF revision SHAs + deduplicate requirement_check (#1135) #1157 — pinned adapter catalog entries to HF revision SHAs (reduces cache misses, complementary fix)
- PR fix: remove drift detection from intrinsic tests and pin tests to SHAs #1196 — removes HF drift detection from intrinsic tests (reduces unnecessary HF hits, complementary fix)
- Issue Design proposal: ModelOutputThunk structural cleanup (#909) #1197 — correctness bug:
HTTPErrorcatch in embedding download loop silently truncates on 429
Metadata
Metadata
Assignees
Labels
area/adapter-functionsGranite adapter functions: framework and adaptiers including RAG, Guardian, Corearea/aloraLoRA/aLora adapter trainingarea/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMbugSomething isn't workingtesting
Activity
fix(retrievers): fix 429 silently truncating embedding downloads
test: centralise HF Hub skip guard to boost CI resiliency against 429…
fix(retrievers): propagate non-404 HTTP errors from embedding downloa…