From de3bd946ddaeedf7d91c39e43aa98e73651a049e Mon Sep 17 00:00:00 2001 From: Sarav Date: Fri, 27 Mar 2026 10:54:27 +0530 Subject: [PATCH 1/3] fix: `Config.update()` writes to wrong file, settings via `PATCH /config` are silently lost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Config.update()` wrote to `config.json` in the project directory, but `Config.state()` loads project config from `opencode.json` / `opencode.jsonc` via `ConfigPaths.projectFiles("opencode", ...)`. The file names didn't match, so any setting saved through `PATCH /config` (model selection, provider config, etc.) was written to a file that was never read back. This caused the VS Code extension's model picker to appear to save the selection but the server would fall back to the provider-level default model on the next request — leading to errors like "No endpoints found for google/gemini-3-pro-preview" when the default model was stale. The fix finds the existing project config file using the same `ConfigPaths.projectFiles()` that `state()` uses, falling back to `opencode.json` if none exists. --- packages/opencode/src/config/config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index a19a18379c..0b12a396b7 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -1425,7 +1425,11 @@ export namespace Config { } export async function update(config: Info) { - const filepath = path.join(Instance.directory, "config.json") + // Find an existing project config file, or default to opencode.json. + // ConfigPaths.projectFiles("opencode", ...) looks for opencode.jsonc and opencode.json, + // so we must write to one of those — not config.json which is never loaded by state(). + const projectFiles = await ConfigPaths.projectFiles("opencode", Instance.directory, Instance.worktree) + const filepath = projectFiles[projectFiles.length - 1] ?? path.join(Instance.directory, "opencode.json") const existing = await loadFile(filepath) await Filesystem.writeJson(filepath, mergeDeep(existing, config)) await Instance.dispose() From 794b11030cc41b1951ab079216730dc6a2a1eed9 Mon Sep 17 00:00:00 2001 From: Sarav Date: Fri, 27 Mar 2026 19:47:02 +0530 Subject: [PATCH 2/3] test: update config test to expect opencode.json instead of config.json `Config.update()` now writes to `opencode.json` (via `ConfigPaths.projectFiles()`), not the legacy `config.json`. Update the assertion to match. Co-Authored-By: Claude Sonnet 4.6 --- packages/opencode/test/config/config.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/test/config/config.test.ts b/packages/opencode/test/config/config.test.ts index d90b0ce4ad..35e3a696cf 100644 --- a/packages/opencode/test/config/config.test.ts +++ b/packages/opencode/test/config/config.test.ts @@ -699,7 +699,7 @@ test("updates config and writes to file", async () => { const newConfig = { model: "updated/model" } await Config.update(newConfig as any) - const writtenConfig = await Filesystem.readJson(path.join(tmp.path, "config.json")) + const writtenConfig = await Filesystem.readJson(path.join(tmp.path, "opencode.json")) expect(writtenConfig.model).toBe("updated/model") }, }) From bc852ac7ca8c27deba018c80698c473677e4f6d2 Mon Sep 17 00:00:00 2001 From: Sarav Date: Fri, 27 Mar 2026 19:48:08 +0530 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20remove=20stale=20@ts-expect-error=20?= =?UTF-8?q?in=20sqlserver.ts=20=E2=80=94=20@types/mssql=20now=20provides?= =?UTF-8?q?=20declarations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- packages/drivers/src/sqlserver.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/drivers/src/sqlserver.ts b/packages/drivers/src/sqlserver.ts index b9aac91760..6491dfa65e 100644 --- a/packages/drivers/src/sqlserver.ts +++ b/packages/drivers/src/sqlserver.ts @@ -7,7 +7,6 @@ import type { ConnectionConfig, Connector, ConnectorResult, SchemaColumn } from export async function connect(config: ConnectionConfig): Promise { let mssql: any try { - // @ts-expect-error — mssql has no type declarations; installed as optional peerDependency mssql = await import("mssql") mssql = mssql.default || mssql } catch {