Skip to content

Allowlist the huggingface-hub backoff loop that reddened every PR - #8130

Closed
danielhanchen wants to merge 1 commit into
mainfrom
scan-baseline-hub-http
Closed

danielhanchen wants to merge 1 commit into
mainfrom
scan-baseline-hub-http

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

pip scan-packages is failing on every open pull request, on the hf-stack, studio and extras legs:

[1] CRITICAL  C2 polling/beaconing loop detected
    Package:  huggingface-hub
    File:     huggingface_hub/utils/_http.py
    Evidence: L461:     while True: sha256:0c9641548adea74be4a8b0e86e8b75cc937a2b0f833b57dfa3d30d3e24d2537a
Summary: 1 CRITICAL, 295 MEDIUM

huggingface-hub 1.27 refactored http_backoff and http_stream_backoff onto a shared _http_backoff generator. That moved the retry loop and changed the code inside it, and since the baseline hashes the matched code rather than its line number, a changed body correctly reopens the finding instead of staying silently suppressed. The two _http.py entries already in the baseline cover the same construct at its earlier locations.

Reviewed against the 1.27.0 sdist. The loop is bounded, not a beacon:

while True:
    nb_tries += 1
    ...
    if nb_tries > max_retries:
        hf_raise_for_status(response)   # raises
        return False                    # or returns, ending the loop

The entry was generated with scan_packages.py's own evidence hash and inserted beside its siblings, so the diff is eight added lines and no reordering of the other 222 entries.

This does not fix the three Repo tests (CPU) failures currently on main; #8115 covers those.

huggingface-hub 1.27 refactored http_backoff into a shared _http_backoff
generator, which moved the retry loop and changed the code inside it. The
baseline hashes the matched code, so a changed loop body correctly reopens the
finding for review rather than staying suppressed, and scan-packages went
CRITICAL on the hf-stack, studio and extras legs of every pull request.

Reviewed against the 1.27.0 sdist: huggingface_hub/utils/_http.py L461 is the
retry loop of _http_backoff. It is bounded, not a beacon: nb_tries increments
each pass and once nb_tries > max_retries the helper calls hf_raise_for_status
and the loop ends. The two sibling _http.py entries already in this file cover
the same construct at its previous locations.

Generated with scan_packages.py's own evidence hash, and inserted beside its
siblings so the diff is the eight added lines and nothing else.
@danielhanchen

Copy link
Copy Markdown
Member Author

main is red in three independent places right now, and each of these three PRs fixes exactly one of them, so every one of them still shows the other two as failures. Merging all three in any order turns main green; merging any one alone will not.

None of the three touches the others' files, so there are no conflicts between them.

@danielhanchen

Copy link
Copy Markdown
Member Author

Superseded by #8135, closing.

#8135 landed the identical entry: same package, file, check and evidence_hash 70d25136.... Verified on main, so the finding is suppressed and pip scan-packages is green there. Nothing here to add.

@danielhanchen
danielhanchen deleted the scan-baseline-hub-http branch August 8, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant