revert: stop forwarding the Small Model override into the managed OpenCode config

Reverts #2687. In real use the injected small_model behaves poorly with
OpenCode: its internal small-model consumers and OpenChamber's own small
model are different things and must stay configured separately.
This commit is contained in:
Bohdan Triapitsyn
2026-08-29 01:14:02 +03:00
parent 48bcac1758
commit 8aba30ac43
5 changed files with 5 additions and 175 deletions
+4 -19
View File
@@ -76,7 +76,6 @@ import { configureOpenCodeRuntimeProviders, resetOpenCodeRuntimeProviders } from
import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
import { createSessionAssistRuntime } from './lib/session-assist/runtime.js';
import { createSessionGoalRuntime } from './lib/session-goal/runtime.js';
import { applySmallModelOverrideToOpenCodeConfig } from './lib/small-model/config-injection.js';
import { createContextObligatoryRuntime } from './lib/context-obligatory/runtime.js';
import { createSessionKnowledgeRuntime } from './lib/session-knowledge/runtime.js';
import { createScheduledTasksRuntime } from './lib/scheduled-tasks/runtime.js';
@@ -1205,25 +1204,11 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
const managedEnv = includeControl || includeWeb || includeMemory
? await (agentToolRuntime?.prepareManagedOpenCodeEnv({ includeControl, includeWeb, includeMemory }) || {})
: {};
const envWithSystemPrompt = settings?.optimizeSystemPrompt === true
? {
...managedEnv,
...(await systemPromptRuntime.prepareManagedOpenCodeEnv(
managedEnv.OPENCODE_CONFIG_CONTENT ?? process.env.OPENCODE_CONFIG_CONTENT,
)),
}
: managedEnv;
if (settings?.optimizeSystemPrompt !== true) return managedEnv;
// Apply the explicit Small Model override to the managed OpenCode config
// so OpenCode's own title/summary generation uses the user's chosen model.
const configContent = envWithSystemPrompt.OPENCODE_CONFIG_CONTENT ?? process.env.OPENCODE_CONFIG_CONTENT;
const withSmallModel = applySmallModelOverrideToOpenCodeConfig({
configContent,
smallModelUseDefault: settings?.smallModelUseDefault,
smallModelOverride: settings?.smallModelOverride,
});
if (withSmallModel === configContent) return envWithSystemPrompt;
return { ...envWithSystemPrompt, OPENCODE_CONFIG_CONTENT: withSmallModel };
const configContent = managedEnv.OPENCODE_CONFIG_CONTENT ?? process.env.OPENCODE_CONFIG_CONTENT;
const systemPromptEnv = await systemPromptRuntime.prepareManagedOpenCodeEnv(configContent);
return { ...managedEnv, ...systemPromptEnv };
},
});