fix(runner): cap HuggingFace Retry-After backoff at 30s - #50
Conversation
Honor Retry-After integer seconds and HTTP-date values only up to the existing 30s quadratic fallback ceiling. A 429 with Retry-After: 3600 could block clawscan benchmark for an hour per attempt when the client context is Background. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 9, 2026, 9:57 PM ET / September 10, 2026, 01:57 UTC (Revision 31). ClawSweeper reviewWhat this changesCaps Hugging Face dataset retry delays at 30 seconds for both Retry-After formats and adds assertions for each. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 5 items remain The change remains absent from main and v0.1.7, so this PR is still relevant. The prior cooldown regression remains unresolved, and the supplied helper-test transcript does not establish real HTTP recovery. Priority: P2 Review scores
Verification
How this fits togetherClawScan fetches Hugging Face dataset rows before running benchmark scans and evaluating results. Its shared HTTP retry loop determines whether temporary server failures recover or abort the benchmark. flowchart TD
A[Benchmark command] --> B[Dataset HTTP client]
B --> C[Server response]
C --> D{Retryable failure?}
D -->|Yes| E[Retry delay and attempt limit]
E --> B
D -->|No| F[Dataset rows or error]
F --> G[Benchmark evaluation]
Decision needed
Why: A fixed 30-second fallback ceiling does not establish permission to shorten server-directed cooldowns; the change trades existing recovery behavior for shorter failure latency. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve server-directed cooldowns by default, with any maintainer-approved bounded-wait mode ending explicitly at its deadline rather than retrying early. Do we have a high-confidence way to reproduce the issue? Yes, source establishes both the existing one-hour wait for Retry-After: 3600 and the branch's premature retry-budget exhaustion when a server enforces that cooldown; neither scenario was executed during this review. Is this the best way to solve the issue? No. Shortening a requested cooldown changes recovery semantics; an explicit deadline or cancellation policy can bound waiting without issuing requests before the server is ready. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6432c40f2340. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (30 earlier review cycles; latest 8 shown)
|
What Problem This Solves
clawscan benchmark clawhub-security-signalsfetches HuggingFace dataset rows and retries on 429/5xx.huggingFaceRowsBackoffhonorsRetry-Afteras integer seconds or an HTTP-date with no ceiling, while the quadratic fallback is already capped at 30s.The public CLI builds
HuggingFaceBenchmarkClientwith a nil Context, sorequestContext()iscontext.Background()and the retryselectnever expires. A 429 withRetry-After: 3600blocks the process for one hour per attempt (up to five waits). This change capsRetry-Afterat the same 30s ceiling. It does not add a process-wide signal context.The uncapped header path was introduced in #3 (2026-06-25). #46 made the wait cancelable when a context is set; it did not cap the delay.
Evidence
Red (unfixed
huggingFaceRowsBackoff):Green (after the 30s cap):
Retry-After: 3600and an HTTP-date two hours ahead both return 30s. The quadratic fallback path is unchanged.Real behavior proof
Behavior or issue addressed: HuggingFace row-fetch
Retry-Afterdelays (integer seconds and HTTP-date) are capped at 30s, matching the existing fallback ceiling, so a 429 cannot stallclawscan benchmarkfor an hour per attempt.Real environment tested: macOS 26.6.2 (Darwin 25.6.0 arm64), go1.27.0 darwin/arm64, checkout
/tmp/oc-pr-clawscan-F003onfix/f003-huggingface-retry-after-cap.Exact steps or command run after this patch:
go test -count=1 -timeout 30s -v -run TestHuggingFaceRowsBackoffCapsRetryAfter ./internal/runner/Evidence after fix: terminal output from the patched tree:
Observed result after fix:
Retry-After: 3600is 30s (was 1h). An HTTP-date two hours ahead is also 30s. The helper no longer returns a multi-hour wait.What was not tested: A live HuggingFace 429 with a long
Retry-Afterheader. Network fetch ofdatasets-server.huggingface.coduring this change.Command:
go test -count=1 -timeout 30s -v -run TestHuggingFaceRowsBackoffCapsRetryAfter ./internal/runner/Observed: unfixed delay was
1h0m0sforRetry-After: 3600; patched delay is30sfor both3600and a future HTTP-date.Expected: both header forms cap at 30s.
Time: 11:07:34 PDT (2026-08-29 18:07:34 UTC)
Date: 2026-08-29
Environment: macOS 26.6.2, Darwin 25.6.0 arm64, go1.27.0 darwin/arm64