Skip to content

fix(opencode): persist Config.update to the loaded config file - #42257

Closed
mdrkrg wants to merge 2 commits into
anomalyco:devfrom
mdrkrg:config-update-target
Closed

mdrkrg wants to merge 2 commits into
anomalyco:devfrom
mdrkrg:config-update-target

Conversation

@mdrkrg

@mdrkrg mdrkrg commented Aug 13, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #42276 and #28966

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The SDK's client.config.update (PATCH /config) returned 200 but the mutation was silently lost: a follow-up GET returned the original config and the file on disk was untouched. Updates were written to config.json, a legacy filename the config loader ignores, so they vanished when the instance was disposed and reloaded after the PATCH.

After this change:

  • The update persists to the project config file the loader reads last (existing opencode.json / opencode.jsonc or .opencode/ overlay), merged with existing content
  • A follow-up GET reflects the change
  • Home (~/.opencode), global, and managed configs won't be written

How did you verify your code works?

  • Tests covering:
    • plain opencode.json / opencode.jsonc targets
    • .opencode/ overlay preference
    • worktree-level precedence
    • token preservation
    • reload persistence
    • end-to-end HTTP tests through the real server app
  • Built the server binary and tested with a real SDK client

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

mdrkrg added 2 commits August 13, 2026 14:07
The SDK PATCH /config endpoint returned 200 but the mutation was
silently lost once the instance reloaded from disk. Updates now
persist to the file the config loader reads.
@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@mdrkrg mdrkrg closed this Aug 13, 2026
@mdrkrg mdrkrg reopened this Aug 13, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config.update() writes runtime local config to ignored project-root config.json (re-open)

1 participant