Skip to content

fix: detect HuggingFace token when downloading cookbook models#3459

Merged
alteixeira20 merged 6 commits into
odysseus-dev:devfrom
muhamedhamedvl:fix/huggingface-token-detection-3422
Jun 11, 2026
Merged

fix: detect HuggingFace token when downloading cookbook models#3459
alteixeira20 merged 6 commits into
odysseus-dev:devfrom
muhamedhamedvl:fix/huggingface-token-detection-3422

Conversation

@muhamedhamedvl

@muhamedhamedvl muhamedhamedvl commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Saving a HuggingFace token in Cookbook → Settings did not persist because cookbook-hwfit.js registered a second change handler on #hwfit-hftoken. It ran after cookbook.js cleared the input and overwrote _envState.hfToken with "", so the debounced sync never wrote the token to cookbook_state.json. Gated model downloads then reported [odysseus] HF token: NOT SET. This PR removes the duplicate handlers, adds shared load_stored_hf_token() (with env-var fallback), and uses it for the download API and agent download path.

Target branch

  • This PR targets dev, not main.

Linked Issue

Fixes #3422

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up or uvicorn app:app) and verified the change works end-to-end.

How to Test

  1. docker compose up and log in.
  2. Open Cookbook → Settings, paste a HuggingFace access token, then blur the field (saved confirmation should appear).
  3. Reload the page.
  4. Start a download for a gated model (e.g. Qwen3.5-9B).
  5. Expect [odysseus] HF token: applied in the log — not NOT SET — gated/private models will be denied.
  6. python -m pytest tests/test_cookbook_hf_token.py -q — expect 3 passed.

@github-actions github-actions Bot added the needs work PR description incomplete — please update before review label Jun 8, 2026
@github-actions github-actions Bot added ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jun 8, 2026
@CWhitlockOfficial

Copy link
Copy Markdown

Thanks for this, hope this is accepted soon! Same issue on Linux as well and this would fix it.

@muhamedhamedvl

Copy link
Copy Markdown
Contributor Author

@alteixeira20

@alteixeira20

Copy link
Copy Markdown
Collaborator

Hi @muhamedhamedvl, sorry for the delay! Do you mind fixing the conflicts then I'll take a closer look to this PR?

@muhamedhamedvl

Copy link
Copy Markdown
Contributor Author

Hi @alteixeira20,
I've resolved the conflicts. I'd appreciate it if you could take another look when you have time.

Thanks!

@alteixeira20 alteixeira20 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGFM.

Validated the refreshed head. The scope is limited to the HuggingFace token persistence/download path fix, CI is green, focused token tests pass, related cookbook tests pass, syntax checks pass, and the merge probe is clean.

@alteixeira20
alteixeira20 merged commit 3b3c0d6 into odysseus-dev:dev Jun 11, 2026
14 checks passed
jdmanring pushed a commit to jdmanring/odysseus that referenced this pull request Jun 13, 2026
…form, settings fixes

Upstream commits included:
- fix: detect HuggingFace token from env when downloading (odysseus-dev#3459)
- fix(platform): read /proc/version with utf-8
- fix(settings): degrade load_features to defaults on PermissionError
- test(memory): cover owner isolation for memory search

Conflict in cookbook_routes.py: _load_stored_hf_token() inline implementation
vs upstream's extraction to cookbook_helpers.load_stored_hf_token(). Resolved
by accepting upstream's version (strictly better — shared utility, also handles
HUGGING_FACE_HUB_TOKEN). Our fix/hf-token-env-fallback branch is superseded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jdmanring pushed a commit to jdmanring/odysseus that referenced this pull request Jun 13, 2026
…diepie-archdaemon#3459

Upstream extracted load_stored_hf_token() to cookbook_helpers.py in their
own fix for the same env-var fallback issue. Both fix/hf-token-persistence
and fix/hf-token-env-fallback are now covered by the upstream implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kootenayalex pushed a commit to kootenayalex/odysseus-mlx that referenced this pull request Jun 16, 2026
…eus-dev#3459)

Co-authored-by: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HuggingFace Token not detected

3 participants