From d248c9161119b01e5411fb6483648c7031152826 Mon Sep 17 00:00:00 2001 From: mingmxren Date: Thu, 5 Mar 2026 22:59:31 +0800 Subject: [PATCH] fix(commands): remove unintended config mutation in SwitchModel SwitchModel should only update the routed agent's runtime Model field. Writing to cfg.Agents.Defaults.ModelName was a behavioral change that corrupts the default agent config when switching a non-default agent. Co-Authored-By: Claude Opus 4.6 --- pkg/agent/loop.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 195623dc5..d2a4e27b6 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -1532,9 +1532,6 @@ func (al *AgentLoop) buildCommandsRuntime(agent *AgentInstance) *commands.Runtim rt.SwitchModel = func(value string) (string, error) { oldModel := agent.Model agent.Model = value - if al.cfg != nil { - al.cfg.Agents.Defaults.ModelName = value - } return oldModel, nil } }