From 15819b7a24e273c6b56371e8342b46dfccbe1b9b Mon Sep 17 00:00:00 2001 From: David Herman Date: Thu, 12 Mar 2026 15:08:15 +0100 Subject: [PATCH] fix(core): resolve model via switch_to_mode in ensure_current_mode Ensure default-mode initialization applies agent-specific model precedence instead of falling back to top-level model when current_mode is first set. --- lua/opencode/core.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/opencode/core.lua b/lua/opencode/core.lua index ee7f8618..d8d06630 100644 --- a/lua/opencode/core.lua +++ b/lua/opencode/core.lua @@ -518,10 +518,10 @@ M.ensure_current_mode = Promise.async(function() -- Try to use the configured default mode if it's available if default_mode and vim.tbl_contains(available_agents, default_mode) then - state.current_mode = default_mode + return M.switch_to_mode(default_mode):await() else -- Fallback to first available agent - state.current_mode = available_agents[1] + return M.switch_to_mode(available_agents[1]):await() end end return true