Skip to content

Hub token identity tests: let the llama-backend stubs take the caller's token after #13005 - #556

Closed
danielhanchen wants to merge 4 commits into
mainfrom
mirror-pr-13022
Closed

danielhanchen wants to merge 4 commits into
mainfrom
mirror-pr-13022

Conversation

@danielhanchen

Copy link
Copy Markdown
Owner

What

Backend CI (Python 3.13, a-k) has been red on main since #13005 (184e1fc3e):

FAILED tests/test_hub_token_caller_identity.py::test_a_cached_alias_repo_is_authorized_in_its_own_right - TypeError: _st_resolver.<locals>.<lambda>() takes 1 positional argument but 2 were given
... 7 failed

Cause

#13005 changed _llama_backend_active(model) to _llama_backend_active(model, token) in routes/settings.py, and _resolve_embedding_model_plan now passes the caller's Hub token. Whether llama-server or sentence-transformers serves a repo depends on reading its modules.json / config.json, which a private repo only shows to a token that reaches it. The product change is right.

The two stub tables in test_hub_token_caller_identity.py (_st_resolver, _gguf_resolver) still gave that name a one-argument lambda. Every test that reaches the resolver preamble raised before the behaviour under test ran.

Change

  • The two stubs take the token and ignore it, as they already did with the model. No other test file stubs _llama_backend_active with a one-argument lambda; test_embedding_model_resolve.py already uses lambda *_:.
  • New test, test_the_backend_probe_is_asked_with_the_callers_token: it pins that the resolver really passes the caller's token to the backend probe. The fixed stubs alone would also pass if a later change dropped the token.

Verification

Run with Python 3.13, CPU torch, and the same installs as Backend CI.

result
main's test_hub_token_caller_identity.py 7 failed, 190 passed
this branch's file 198 passed
this branch with the resolver changed to drop the token 1 failed (the new test), 197 passed
this branch + test_embedding_model_resolve.py + test_embedding_model_security_gate.py, -n 4 283 passed, 1 skipped

Mirror of unslothai/unsloth#13022 by @lonexreb, opened for review only.
Do not merge here. Fixes agreed on this mirror must be applied to the source PR.
Source description digest at mirror time: 098bdc44c260

lonexreb and others added 3 commits October 7, 2026 23:16
…12979 now passes

#12979 (184e1fc) made `_llama_backend_active(model, token)` so the embedding resolver
can gate the llama-server path on the caller's Hub token, and `_resolve_embedding_model_plan`
now calls it with both. The two stub tables in `test_hub_token_caller_identity.py` still
hand it a one-argument lambda, so every test built on `_st_resolver` / `_gguf_resolver`
fails with `TypeError: <lambda>() takes 1 positional argument but 2 were given`: seven
cases, red on Backend CI `(Python 3.13, a-k)` for 184e1fc and 04013e9.

The stubs now accept the token and ignore it, which is what they did with the model.
`tests/test_hub_token_caller_identity.py`: 197 passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012DRiTpjxAymRtv9p8Xr2kd
…r's token

#13005 made _resolve_embedding_model_plan pass the caller's Hub token to
_llama_backend_active, because whether llama-server or sentence-transformers
serves a private repo depends on files only that token can read. The stubs
fixed above made the suite pass again but nothing checked the token still
arrives; this test fails if the resolver drops it.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T03:54:21.571811Z c718ac0 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Owner Author

@codex review

Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 10, 2026
@danielhanchen

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: c718ac0f21

ℹ️ 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".

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.

2 participants