Repository navigation
fix(server): close tokenizer config before building chat handler - #2422
Open
cloudgpuapp wants to merge 2 commits into
Open
cloudgpuapp wants to merge 2 commits into
cloudgpuapp wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
hf-tokenizer-configpassesjson.load(open(path))directly to the chat-handler factory. On invalid JSON, retaining the parsing exception also retains thejson.loadframe and its open file. Successful parsing relies on implicit finalization and emits an unclosed-fileResourceWarningon CPython.Read the config in a
withblock, close it before building the handler, and pass the same parsed dictionary onward. File-open, JSON and handler errors still propagate; the default text encoding is unchanged. This is separate from model-proxyfree()and metadata-override parsing.Validation on macOS arm64:
json.load, including a retainedJSONDecodeErrortraceback. Tests check warnings on success and handler failure, and preserve the missing-file error.server/model.pyandserver/settings.pyare imported. The local runner replaces the native package entry and auxiliary native modules at import; model construction and the handler factory are mocked. It does not load a compiled backend or model. The committed test file uses normal package imports.make lintandgit diff --checkpass; patch applicability checked against current main.python -m pytest tests/test_server_tokenizer_config_file.py -q.Prepared with AI assistance. No provider integration or promotional link is added.