Fix OAuth token authorization for Space logging - #685
Merged
Conversation
Contributor
🪼 branch checks and previews
|
Contributor
🦄 change detectedThis Pull Request includes changes to the following packages.
|
abidlabs
requested review from
Saba9 and
qgallouedec
and
a balanced review from Copilot
September 5, 2026 00:21
abidlabs
marked this pull request as ready for review
September 5, 2026 00:21
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Authorization caching remains stale indefinitely, regression tests are missing, and the changeset should be bot-generated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates Space logging authorization to use the Hub’s repository write-access check.
Changes:
- Replaces token metadata parsing with
HfApi.auth_check. - Expands authorization caching and preserves the Space-secret fast path.
- Adds patch release metadata.
File summaries
| File | Description |
|---|---|
trackio/server.py |
Updates Space token authorization. |
.changeset/soft-ears-find.md |
Adds release metadata. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
|
|
||
| @lru_cache(maxsize=32) | ||
| @lru_cache(maxsize=256) |
Comment on lines
+388
to
393
| HfApi.auth_check( | ||
| f"{owner_name}/{repo_name}", | ||
| repo_type="space", | ||
| token=hf_token, | ||
| write=True, | ||
| ) |
Comment on lines
+1
to
+5
| --- | ||
| "trackio": patch | ||
| --- | ||
|
|
||
| feat:Fix OAuth token authorization for Space logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
whoami()["auth"]["accessToken"]huggingface-hub>=1.10.0,<2constraint becauseHfApi.auth_check(..., write=True)is available in 1.10.0Reproduction
Before this change, a valid OAuth-shaped
whoamiresponse withoutauth.accessTokencrashes the Space write check:The fix asks the Hub whether the token has write access to the exact Space, avoiding assumptions about token metadata.
Verification
The reproduction was run inline; no demo file was committed.