Skip to content

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

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
lonexreb:fix/hub-token-identity-stubs-take-token
Oct 10, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
lonexreb:fix/hub-token-identity-stubs-take-token

Conversation

@lonexreb

@lonexreb lonexreb commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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

…nslothai#12979 now passes

unslothai#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

unslothai#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.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@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:50:25.922471Z 444b3e7 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 danielhanchen changed the title Hub token identity tests: let the llama-backend stub take the token #12979 now passes Hub token identity tests: let the llama-backend stubs take the caller's token after #13005 Oct 10, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 444b3e7bde

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

@shimmyshimmer

Copy link
Copy Markdown
Member

Review record for #13022, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#556.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror c718ac0f21 (this PR's c718ac0f2)

chatgpt-codex-connector[bot] (on the mirror)

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

Reviewed commit: c718ac0f21

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror c718ac0f21 (this PR's c718ac0f2).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of 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.

3 participants