fix(server): forward Small Model override to managed OpenCode config

OpenChamber's Settings → Chat → Small Model override only fed OpenChamber's
own /api/small-model/generate utility service; it never reached the managed
OpenCode server, whose internal title/summary generation reads small_model
from its config. With the override injected into OPENCODE_CONFIG_CONTENT at
managed-process launch, session title generation uses the user's explicit
model instead of falling back (or failing to resolve) — fixing sessions that
stayed untitled even with a Small Model configured.

Only an explicit override (smallModelUseDefault === false with a non-empty
smallModelOverride) is injected; "use default" leaves the config untouched
so OpenCode's own resolution chain stays authoritative. Malformed user config
is left unmodified. External OpenCode servers are unaffected (they are not
launched with this env).

Fixes #2497
This commit is contained in:
Serhii Dziupin
2026-08-05 13:46:30 +03:00
parent 34c221b07f
commit 8a85073261
4 changed files with 166 additions and 5 deletions
@@ -114,6 +114,17 @@ other runtime API.
- `routes.js` — `GET /api/small-model` (resolution preview) and
`POST /api/small-model/generate` (`{ prompt, system?, maxOutputTokens?,
model?, directory? }` → `{ text, providerID, modelID, source }`).
- `config-injection.js` — applies the Settings → Chat → Small Model override
to the config injected into the **managed OpenCode process**
(`OPENCODE_CONFIG_CONTENT`), so OpenCode's own internal `small_model`
consumers — session title and summary generation — use the user's explicit
choice instead of OpenCode's fallback chain. Only an explicit override
(`smallModelUseDefault === false` with a non-empty `smallModelOverride`) is
injected; "use default" leaves the config untouched so OpenCode's own
resolution stays authoritative. Wired into `getManagedOpenCodeEnv` in
`server/index.js`; the pure helper is unit-tested in
`config-injection.test.js`. External OpenCode servers are unaffected (they
are not launched with this env).
## Registration