Skip redundant model switch

This commit is contained in:
IAvecilla
2026-06-12 11:03:44 -07:00
committed by Teknium
parent 8c3c08c50b
commit bc3f4ed70f
2 changed files with 38 additions and 0 deletions
+7
View File
@@ -2036,6 +2036,13 @@ def _sync_agent_model_with_config(sid: str, session: dict) -> None:
if target == seen:
return
model, provider = target
# Already running the configured model (branched/resumed session before
# its first sync, or a config revert after a failed switch): adopt the
# baseline without a redundant switch.
if model == getattr(agent, "model", "") and (
not provider or provider == getattr(agent, "provider", "")
):
return
raw = f"{model} --provider {provider}" if provider else model
try:
_apply_model_switch(