fix: use LM Studio max_context_length when model is loaded at default 64K - #45037
Closed
lunarnexus wants to merge 1 commit into
Closed
fix: use LM Studio max_context_length when model is loaded at default 64K#45037lunarnexus wants to merge 1 commit into
lunarnexus wants to merge 1 commit into
Conversation
1 task
Contributor
Author
|
Reviving this PR because it addresses a different LM Studio failure mode than #36852.
So this one is for the JIT/default-64K autodiscovery path, not the config-override path. |
lunarnexus
marked this pull request as ready for review
June 19, 2026 06:09
This was referenced Jun 19, 2026
Contributor
Author
1 task
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
max_context_lengthwhen the loaded instance context is only Hermes' 64K minimum/defaultProblem
Hermes auto-discovers LM Studio context by checking
loaded_instances[].config.context_lengthfrom/api/v1/models.When Hermes JIT-loads a model without an explicit context override, LM Studio can load it at the default 64K. Hermes then reports 64K as the model context even when the model's advertised
max_context_lengthis much higher.Fix
If the loaded instance context is only Hermes' default/minimum load size, fall back to LM Studio's advertised
max_context_length. If the loaded instance is already above that minimum, keep using the loaded runtime value.Why this PR is separate from #36852
This fixes the LM Studio JIT-loaded autodiscovery path.
PR #36852 fixes a different layer:
custom_providersper-modelcontext_lengthlookup when LM Studio reports model ids aspublisher/slug.Related to #30178.