Skip to content

Config.update() writes runtime local config to ignored project-root config.json #28966

Description

@ReqX

Description

Runtime local config updates made through Config.update() do not round-trip through instance disposal/reload correctly.

Config.update() writes to project-root config.json, but fresh project config loading reads the normal opencode.json / opencode.jsonc paths and local .opencode/opencode.json[c] overlays instead.

Because of that mismatch, a runtime config update can appear to work immediately, then disappear after the instance is disposed and reloaded.

I have a PR prepared for this.

Plugins

alvinunreal/oh-my-opencode-slim

OpenCode version

Observed on v1.15.7 and v1.15.10, and traced on current dev before fix.

Steps to reproduce

  1. Start with a project where a runtime config update changes agent config through the config update path
  2. Trigger the config update
  3. Let the instance get disposed/reloaded
  4. Use the updated config again after reload

Screenshot and/or share link

No response

Operating System

Linux

Terminal

No response


Expected behavior

Runtime local config updates should be persisted to the local config overlay that fresh reload already reads, so they survive disposal/reload.

Actual behavior

Runtime local updates are written to project-root config.json, which fresh project config loading does not read, so runtime-added config can disappear after reload.

Root cause

  • Config.update() writes config.json
  • project config loading uses opencode.json / opencode.jsonc + .opencode overlays
  • the reload path itself appears fine; the persisted file target is wrong

Proposed fix

Write runtime local updates to the managed local overlay instead:

  • prefer existing .opencode/opencode.jsonc
  • else existing .opencode/opencode.json
  • else create .opencode/opencode.jsonc

This matches the normal local reload path and keeps runtime-managed overrides out of the project root.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions