[PR #12347] fix: PATCH /config writes to correct project config file #14179

Open
opened 2026-02-16 18:18:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12347

State: open
Merged: No


What does this PR do?

Config.update() writes to config.json in the project directory, but the config loader only reads opencode.jsonc and opencode.json — so project-level config updates via PATCH /config are silently lost.

This changes update() to use a new projectConfigFile() helper (mirrors the existing globalConfigFile() pattern) that picks whichever of opencode.jsonc / opencode.json already exists, defaulting to opencode.json.

Fixes #4194
Fixes #6984

How did you verify your code works?

All 57 config tests pass (bun test test/config/config.test.ts). Updated the existing "updates config and writes to file" test to assert against opencode.json instead of config.json.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12347 **State:** open **Merged:** No --- ## What does this PR do? `Config.update()` writes to `config.json` in the project directory, but the config loader only reads `opencode.jsonc` and `opencode.json` — so project-level config updates via `PATCH /config` are silently lost. This changes `update()` to use a new `projectConfigFile()` helper (mirrors the existing `globalConfigFile()` pattern) that picks whichever of `opencode.jsonc` / `opencode.json` already exists, defaulting to `opencode.json`. Fixes #4194 Fixes #6984 ## How did you verify your code works? All 57 config tests pass (`bun test test/config/config.test.ts`). Updated the existing "updates config and writes to file" test to assert against `opencode.json` instead of `config.json`.
yindo added the pull-request label 2026-02-16 18:18:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14179