feat: add LM Studio JIT load mode - #42346
Closed
marcelohildebrand wants to merge 1 commit into
Closed
Conversation
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused opt-in path. The current behavior is still present: run_agent.py:761-775 unconditionally routes LM Studio through ensure_lmstudio_model_loaded(), and the shared helper is reached during initialization (agent/agent_init.py:1751), model switches (agent/agent_runtime_helpers.py:2029-2030), and fallback activation (agent/chat_completion_helpers.py:1606-1607).
Problems
model.lmstudio_load_modeis documented and read by the PR, but it is not added to the config schema.hermes_cli/config.py:976-980has no default for it, so schema-driven config consumers cannot discover the setting.tests/run_agent/test_lmstudio_load_mode.pyonly constructs aSimpleNamespaceand tests the helper guard. It does not cover config loading throughinit_agent()into the first preload path.
Suggested changes
- Add the explicit default through the existing model-config normalization path, preserving scalar legacy model config compatibility.
- Add a temp-
HERMES_HOMEconfig-propagation regression test forjitand the default/explicit case.
Automated hermes-sweeper review.
| # just-in-time / Auto-Evict chat-completions path. Keep the default | ||
| # explicit for backward compatibility; users with LM Studio Auto-Evict can | ||
| # opt into JIT via ``model.lmstudio_load_mode: jit``. | ||
| agent.lmstudio_load_mode = "explicit" |
Contributor
There was a problem hiding this comment.
Please add model.lmstudio_load_mode: explicit through the config schema/normalization path as well. The runtime fallback is safe, but leaving the new documented setting out of DEFAULT_CONFIG means schema-driven config consumers cannot discover its default.
kshitijk4poor
added a commit
that referenced
this pull request
Jul 16, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
prmartinow
pushed a commit
to prmartinow/hermes-agent
that referenced
this pull request
Aug 26, 2026
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
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
model.lmstudio_load_modewith a backwards-compatible default ofexplicitmodel.lmstudio_load_mode: jitto skip Hermes' explicit LM Studio preload call and let LM Studio JIT/Auto-Evict manage model loadingMotivation
LM Studio's Hermes integration docs describe JIT loading support, but Hermes currently preloads LM Studio models through the LM Studio management API before the first chat request. That path is useful for enforcing Hermes' minimum context, but it bypasses LM Studio's normal JIT-loading / Auto-Evict behavior. Users who rely on LM Studio Auto-Evict can hit VRAM pressure when the explicit preload path tries to load a model before LM Studio has a chance to evict the previous one.
This change keeps the current explicit preload behavior as the default while allowing users to opt into LM Studio-managed JIT loading:
hermes config set model.lmstudio_load_mode jitTo restore the existing behavior:
hermes config set model.lmstudio_load_mode explicitTesting
uv run --with pytest python -m pytest tests/run_agent/test_lmstudio_load_mode.py tests/run_agent/test_switch_model_context.py -q -o 'addopts='5 passedpython -m py_compile run_agent.py agent/agent_init.py tests/run_agent/test_lmstudio_load_mode.pygit diff --cached --checkNotes
The default remains
explicit, so existing LM Studio users should keep the same behavior unless they opt intojit.