Skip to content

The agent that grows with you

fix: replace RuntimeError with graceful degradation for unverified LM Studio loads

kshitijk4poorf1eef8587784
diff --git a/agent/agent_init.py b/agent/agent_init.py
index b14ca117f30..92d89c8d600 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -2280,9 +2280,9 @@ def init_agent(
_config_context_length
)
if agent._lmstudio_load_was_unverified(_lmstudio_runtime_context_length):
- raise RuntimeError(
+ _ra().logger.warning(
"LM Studio model activation was rejected or completed without a "
- "verifiable active context length; agent startup aborted"
+ "verifiable active context length; falling back to configured context"
)
_effective_context_length = agent._effective_lmstudio_context_length(
_config_context_length,
diff --git a/agent/agent_runtime_helpers.py b/agent/agent_runtime_helpers.py
index c4619de005d..6192556d2cb 100644
--- a/agent/agent_runtime_helpers.py
+++ b/agent/agent_runtime_helpers.py
@@ -2341,10 +2341,10 @@ def switch_model(agent, new_model, new_provider, api_key='', base_url='', api_mo
_destination_context_intent
)
if agent._lmstudio_load_was_unverified(_runtime_context_length):
- _restore_snapshot()
- raise RuntimeError(
+ logger.warning(
"LM Studio model activation was rejected or completed without a "
- "verifiable active context length; model switch aborted"
+ "verifiable active context length during model switch; continuing "
+ "with configured context"
)
_effective_context_length = agent._effective_lmstudio_context_length(
_destination_context_intent,