fix(runtime-fallback): preserve agent variant and reasoningEffort on model fallback (fixes #2621)

When runtime fallback switches to a different model, the agent's
configured variant and reasoningEffort were lost because
buildRetryModelPayload only extracted variant from the fallback
model string itself.

Now buildRetryModelPayload accepts optional agentSettings and uses
the agent's variant as fallback when the model string doesn't
include one. reasoningEffort is also passed through.

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
YeonGyu-Kim
2026-03-18 12:11:01 +09:00
parent 55ac653eaa
commit 9ca259dcdc
3 changed files with 141 additions and 16 deletions
+7 -1
View File
@@ -101,7 +101,13 @@ export function createAutoRetryHelpers(deps: HookDeps) {
return
}
const retryModelPayload = buildRetryModelPayload(newModel)
const agentSettings = resolvedAgent
? pluginConfig?.agents?.[resolvedAgent as keyof typeof pluginConfig.agents]
: undefined
const retryModelPayload = buildRetryModelPayload(newModel, agentSettings ? {
variant: agentSettings.variant,
reasoningEffort: agentSettings.reasoningEffort,
} : undefined)
if (!retryModelPayload) {
log(`[${HOOK_NAME}] Invalid model format (missing provider prefix): ${newModel}`)
const state = sessionStates.get(sessionID)