Description
Config.update — the code path behind PATCH /config — writes <project>/config.json, but project config discovery only reads opencode.json / opencode.jsonc (ConfigPaths.files("opencode", ...)). The update lands in a file that is never loaded again, so it has no effect and leaves a stray config.json in the project.
This was reported in #4194 and fixed in #4205; that PR was closed as stale and the issue was auto-closed for inactivity, with the note to open a new one if it is still relevant. It still reproduces on dev.
I have a fix + tests ready and can open a PR.
Steps to reproduce
- Project with
opencode.json containing "model": "anthropic/claude-sonnet-4-5"
opencode serve --port 4199
-
curl -X PATCH http://127.0.0.1:4199/config \
-H 'content-type: application/json' \
-H "x-opencode-directory: $PROJECT" \
-d '{"model":"anthropic/claude-opus-4-5"}'
Response is 200 {"model":"anthropic/claude-opus-4-5"}, but on disk:
$ ls $PROJECT
config.json opencode.json
$ cat $PROJECT/opencode.json # still the old model
{ "$schema": "https://opencode.ai/config.json", "model": "anthropic/claude-sonnet-4-5" }
$ cat $PROJECT/config.json # written, but never read back
{ "model": "anthropic/claude-opus-4-5" }
Restarting keeps the old model.
OpenCode version
dev @ b155b15 (v1.18.19)
Operating System
macOS (Darwin 25.5)
Description
Config.update— the code path behindPATCH /config— writes<project>/config.json, but project config discovery only readsopencode.json/opencode.jsonc(ConfigPaths.files("opencode", ...)). The update lands in a file that is never loaded again, so it has no effect and leaves a strayconfig.jsonin the project.This was reported in #4194 and fixed in #4205; that PR was closed as stale and the issue was auto-closed for inactivity, with the note to open a new one if it is still relevant. It still reproduces on
dev.I have a fix + tests ready and can open a PR.
Steps to reproduce
opencode.jsoncontaining"model": "anthropic/claude-sonnet-4-5"opencode serve --port 4199Response is
200 {"model":"anthropic/claude-opus-4-5"}, but on disk:Restarting keeps the old model.
OpenCode version
dev@ b155b15 (v1.18.19)Operating System
macOS (Darwin 25.5)