Skip to content

Deduplicate the scan-packages baseline, and gate it with tests - #8110

Merged
danielhanchen merged 1 commit into
unslothai:mainfrom
danielhanchen:fix/baseline-hub-1-27-http-loop
Aug 8, 2026
Merged

danielhanchen merged 1 commit into
unslothai:mainfrom
danielhanchen:fix/baseline-hub-1-27-http-loop

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

pip scan-packages :: hf-stack and :: extras are failing on every open PR, on one CRITICAL:

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

That is http_backoff's retry loop, and the same loop is already in the baseline twice for the same file (L462 and L298). huggingface_hub 1.27.0 was published at 12:48 today, shifting the loop by one line and adding a comment inside it:

    while True:
        nb_tries += 1
        ratelimit_reset = None
        # Fetched on each attempt: a previous attempt may have closed the shared client (see `close_session` below),
        # and closed `httpx.Client` objects cannot be reused.
        client = get_session()

The baseline key is a hash over the matched code, deliberately, so that changed code reopens a reviewed finding. It did its job; the code is benign and the entry is added.

The timing pins it to the release rather than to any PR: #7866 passed both legs at 11:58 and 12:10, #7867 failed them at 12:51 and 12:57, and nothing else changed in between.

Also in here

Five openai entries appear twice, byte for byte, from two --write-baseline runs. Dropped, and two tests added so neither problem is silent again:

  • every shipped entry's evidence_hash must recompute from its own evidence. A hand-added entry with a stale hash suppresses nothing, because the key is the hash, so the finding stays red while the entry reads as a review that happened.
  • no key may appear twice, since that means one of the two was reviewed against code that is no longer there and nothing says which.

tests/security/test_scan_packages.py: 105 passed.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 7, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 7, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

The four Backend tests reds here (Python 3.10 / 3.11 / 3.12 / 3.13) are not from this branch. #7985 widened _stream_completion to return usage and four assertions in test_research_runs_hardening.py still expect the old 3-tuple, so every open PR inherits them.

Confirmed by comparing this branch with #8115/#8110: the two share no files with each other and neither touches studio/backend/tests/, yet both fail on the same four test ids.

Fixed in #8120, with a guard that reads the tuple width from the function's own return annotation so the next arity change cannot drift past the tests again.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: b9cb548540

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

unslothai#8135 re-baselined the huggingface_hub 1.x backoff loop, so that half of this
branch is done upstream. What is left is a defect it did not touch: the shipped
baseline carries five openai entries twice.

  openai/_base_client.py                          C2 polling/beaconing loop
  openai/auth/_workload.py                        IMDS + network calls
  openai/resources/beta/responses/responses.py    C2 polling/beaconing loop
  openai/resources/realtime/realtime.py           C2 polling/beaconing loop
  openai/resources/responses/responses.py         C2 polling/beaconing loop

223 entries, 218 distinct. A duplicated suppression is not harmless: whoever
removes one copy to un-suppress a finding still gets no finding, because the
second copy is still matching.

The 111 tests here cover the baseline's shape and matching semantics, including
the duplicate check that caught this. Every one passes against main once the
five copies are gone.
@danielhanchen
danielhanchen force-pushed the fix/baseline-hub-1-27-http-loop branch from b9cb548 to 3cf73eb Compare August 8, 2026 03:19
@danielhanchen

Copy link
Copy Markdown
Member Author

Rebased onto main and narrowed, because half of this landed without it.

#8135 re-baselined the huggingface_hub 1.x backoff loop, so I dropped that part. What remains is a defect #8135 did not touch: the shipped baseline carries five openai entries twice.

package file check
openai openai/_base_client.py C2 polling/beaconing loop detected
openai openai/auth/_workload.py Accesses cloud metadata/IMDS AND makes network calls
openai openai/resources/beta/responses/responses.py C2 polling/beaconing loop detected
openai openai/resources/realtime/realtime.py C2 polling/beaconing loop detected
openai openai/resources/responses/responses.py C2 polling/beaconing loop detected

223 entries, 218 distinct, measured on 4e193139d. A duplicated suppression is worse than untidy: whoever deletes one copy to un-suppress a finding still sees nothing, because the second copy keeps matching.

The 111 tests here cover the baseline shape and the matching semantics, including the duplicate check that found this. Against unmodified main, test_the_shipped_baseline_has_no_duplicate_keys fails and names all five; with the copies removed the whole file passes.

Worth recording separately: the CI deadlock this PR was caught in has cleared. #8132 repaired the three test files that were reddening the Backend and Repo test jobs, and on a fresh origin/main worktree tests/python/test_studio_runtime_gate.py, tests/studio/test_desktop_reliability_frontend_contract.py and studio/backend/tests/test_research_runs_hardening.py now pass together (156 passed, 11 skipped). #8115 and #8120 are superseded by that, so I am closing them.

@danielhanchen danielhanchen changed the title Baseline the huggingface_hub 1.27.0 http_backoff retry loop Deduplicate the scan-packages baseline, and gate it with tests Aug 8, 2026
@danielhanchen
danielhanchen merged commit da72577 into unslothai:main Aug 8, 2026
19 checks passed
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