Skip to content

fix: authenticate HTTP dataset fallback with the configured Hub token - #88

Open
Afloat16 wants to merge 1 commit into
billion-token-one-task:masterfrom
Afloat16:fix/http-dataset-authentication-20261202-r2
Open

Afloat16 wants to merge 1 commit into
billion-token-one-task:masterfrom
Afloat16:fix/http-dataset-authentication-20261202-r2

Conversation

@Afloat16

@Afloat16 Afloat16 commented Dec 2, 2026

Copy link
Copy Markdown

Problem

The hosted runner falls back to the Dataset Viewer API when the datasets package is absent, but it sends no Hugging Face authorization. A configured token can therefore resolve a gated dataset through the normal resolver while the fallback still fails with 401 when requesting its rows.

Changes

Send the configured HF_TOKEN (or the existing HUGGINGFACE_TOKEN alias) as a Bearer header on the initial rows request. Keep anonymous access when neither is set, preserve primary-token precedence, and use urllib's unredirected header mechanism so the token is not copied to redirect requests.

Official rows API examples use this authorization header: https://github.com/huggingface/dataset-viewer/blob/main/docs/source/rows.md

Validation

  • 4 failed, 1 passed on base.
  • A controlled HTTP service response rejects missing/wrong credentials and returns rows for the expected header. Tests cover both environment variables, their precedence, anonymous requests, and the standard redirect handler's omission of authorization.
  • python -m pytest -q tests/test_http_dataset_authentication.py tests/test_runner_contract_and_failure_policy.py tests/test_served_model_provenance.py: 45 passed, 26 subtests passed.

@cla-assistant

cla-assistant Bot commented Dec 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Dec 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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