Thanks to visit codestin.com
Credit goes to github.com

Skip to content

installer-setup WS-A: thread HF_TOKEN through apply_setup → in-process pulls#1122

Merged
thinmintdev merged 1 commit into
mainfrom
feat/1094-hf-token-apply
Jul 6, 2026
Merged

installer-setup WS-A: thread HF_TOKEN through apply_setup → in-process pulls#1122
thinmintdev merged 1 commit into
mainfrom
feat/1094-hf-token-apply

Conversation

@thinmintdev

Copy link
Copy Markdown
Contributor

Closes #1094

Description

Install-time in-process model pulls (hal0 setup --auto when hal0-api is not up) called apply_setup() without hf_token, so it always defaulted to None — even when HF_TOKEN (or HUGGING_FACE_HUB_TOKEN) was exported in the environment. This caused gated curated model pulls to 401 during a fresh install.

The API path (src/hal0/api/routes/installer.py) already reads os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") and threads it into apply_setup(hf_token=...). This PR mirrors that exact precedence in _apply_in_process (src/hal0/cli/setup_install.py), so the in-process path now reaches parity with the API-up path.

apply_setup in src/hal0/install/orchestrate.py already accepted hf_token: str | None = None and threads it into make_job/PullPlan.kwargs — no changes needed there.

Acceptance checklist

  • HF_TOKEN present in the environment reaches run_pull for install-time in-process pulls
  • Same env-var precedence as the API route (HF_TOKEN then HUGGING_FACE_HUB_TOKEN fallback, else None)
  • No token in env still works for public models (no regression — hf_token=None is apply_setup's own default)
  • Unit coverage that the token is threaded (not hardcoded None): HF_TOKEN set, HUGGING_FACE_HUB_TOKEN fallback, and neither-set → None

Test plan

  • uv run ruff format src tests — clean
  • uv run ruff check src tests — all checks passed
  • uv run ruff format --check src tests — clean
  • uv run pytest tests/cli/test_setup_install.py tests/install/test_orchestrate.py -q — 12 passed
  • uv run pytest tests/ -q --ignore=tests/e2e — 4617 passed, 14 pre-existing failures unrelated to this change (hermes wrapper/state-render, comfyui phase4, proxmox host detection, container spec dispatch, config-url-proxy, models-preview, settings-store), none touching setup_install.py, test_setup_install.py, or orchestrate.py

🤖 Generated with Claude Code

_apply_in_process (hal0 setup --auto, install time, API down) called
apply_setup() without hf_token, so it always defaulted to None even when
HF_TOKEN/HUGGING_FACE_HUB_TOKEN was exported. Gated curated model pulls
then 401'd during a fresh install. Read the token from env with the same
precedence the API route already uses (HF_TOKEN, then
HUGGING_FACE_HUB_TOKEN fallback, else None) and pass it into apply_setup
so run_pull authenticates for gated pulls, matching the API-up path.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@thinmintdev thinmintdev merged commit 1afb441 into main Jul 6, 2026
3 checks passed
@thinmintdev thinmintdev deleted the feat/1094-hf-token-apply branch July 6, 2026 04:44
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.

installer-setup WS-A: thread HF_TOKEN through apply_setup → in-process pulls

1 participant