fix: prevent frontend from stripping hfToken during state sync#5540
Open
qins wants to merge 1 commit into
Open
fix: prevent frontend from stripping hfToken during state sync#5540qins wants to merge 1 commit into
qins wants to merge 1 commit into
Conversation
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
This PR fixes a bug where the HuggingFace Token is never actually saved to the backend disk (
cookbook_state.json), which causes auto-restarted or resumed gated model downloads to permanently stall.When a user enters their HF Token in the UI,
_stripStateSecretsinstatic/js/cookbookRunning.jsaggressively strips thehfTokenfrom the payload before the fetch request is sent. Consequently, the backend never receives the token. This PR modifies_stripStateSecretsto preserve thehfTokenin the payload. It is perfectly safe because the backend already properly handles encrypting the token to disk (_state_for_storage) and stripping it from API responses (_state_for_client).Target branch
dev, notmain.Linked Issue
Fixes #3589
Type of Change
Checklist
devdocker compose uporuvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.How to Test
hfTokensaved incookbook_state.json./api/cookbook/statePOST request payload now includeshfToken.cookbook_state.jsonfile on disk — the token should now be present as an encrypted string.gated/private models will be denied.