Repository navigation
Description
Summary
A single transient HTTP error against the PyPI or npm registry — or
against OSV.dev — turns the whole supply-chain check into
Verdict::Unavailable, which then degrades to Ask. Five times in
24h on this user's machine (pip install for fastapi/jinja2/
python-multipart/pytest) with findings: []. Network was fine
throughout.
Root cause
src/hooks/supply_chain_gate.rs:1574 — http_get_json:
fn http_get_json(url: &str) -> Result<Value, String> {
let mut req = ureq::get(url)
.set("User-Agent", "contextcrawler-supply-chain-gate/0.1")
.timeout(StdDuration::from_secs(8));
...
let resp = req.call().map_err(|e| format!("HTTP {}: {}", url, e))?;
...
}Single attempt. Every ureq::Error (transport, 4xx, 5xx) is mapped to a
String and bubbled. check() at line 2143 sees the first error of the
package loop, refuses to retry the next call against the same registry,
and falls through to Verdict::Unavailable.
http_post_json (OSV.dev) has the same shape.
Proposed fix
Retry-with-backoff on retryable error classes only.
const MAX_RETRIES: u32 = 1; // 2 attempts total
const ATTEMPT_TIMEOUT: Duration = Duration::from_secs(5);
const RETRY_BACKOFF: Duration = Duration::from_millis(250);
fn is_retryable(e: &ureq::Error) -> bool {
match e {
ureq::Error::Status(code, _) => *code >= 500 && *code < 600,
ureq::Error::Transport(_) => true, // connect-reset, timeout, DNS hiccup
}
}5xxand transport errors → retry once4xx→ terminal (don't retry; the package literally doesn't exist or
we're rate-limited and need to back off properly elsewhere)- Total worst case: 5s + 250ms + 5s = ~10.25s per HTTP call. Well within
the existingCHECK_WALL_BUDGET = 25s.
Apply identically to http_get_json (registries) and http_post_json
(OSV).
Tests
is_retryableclassifier: 5xx → true, 4xx → false, Transport → true- Conceptual retry test: pure function that takes a "next attempt
result" iterator and confirms it gives up after MAX_RETRIES, returns
Ok if any attempt succeeds, etc. - Existing 138+ supply-chain regression tests must stay green.
Not covered by this fix
Verdict::Unavailablefrombudget_blown(separate condition,
proportional to install size — fixing that means raising the budget
or parallelising calls; bigger change).- Per-attempt timeout tuning beyond the 5s default — leave as-is unless
empirical data later shows we're losing legitimate slow-but-OK
responses.
Reference: the 5 actual events
2026-05-25T12:16:15 verdict=unavailable cmd=pip install 'fastapi==0.115.0' jinja2 python-multipart …
2026-05-25T12:27:58 verdict=unavailable cmd=pip install 'fastapi==0.115.6' 'jinja2>=3.1' python-multipart …
2026-05-25T12:39:43 verdict=unavailable cmd=pip install --quiet 'fastapi==0.115.6' 'jinja2>=3.1' python-multipart …
2026-05-25T14:04:44 verdict=unavailable cmd=pip list … pip install …
2026-05-25T14:05:16 verdict=unavailable cmd=pip install pytest …
All with findings: []. All when the user was actively online.
Originally filed on the gitea lab mirror. Filing on github for release-notes cross-reference. Already fixed in the inbound PR.
Activity
thehoff commentedon May 26, 2026
Fixed in v0.1.11 via #184.
fix(supply-chain): retry transient HTTP errors so a single blip doesn…
fix(supply-chain): retry transient HTTP errors so a single blip doesn…
security/supply-chain: redact-logs + scrub-logs CLI + inline-bypass +…