Skip to content

Fix: Config Get returns stale data after Patch#20636

Closed
Liyw979 wants to merge 1 commit intoanomalyco:devfrom
Liyw979:dev
Closed

Fix: Config Get returns stale data after Patch#20636
Liyw979 wants to merge 1 commit intoanomalyco:devfrom
Liyw979:dev

Conversation

@Liyw979
Copy link
Copy Markdown

@Liyw979 Liyw979 commented Apr 2, 2026

  • Change config file path from config.json to opencode.json to match the auto-loader which reads from .opencode/opencode.json
  • Add invalidate() call to clear config cache after writing, ensuring subsequent Config.get() calls return updated data

Issue for this PR

Closes #

Type of change

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

Description

After calling the patch /config endpoint to add a custom agent configuration, immediately reading from the /configreturned stale data without the newly patched agent configuration.

What does this PR do?

This PR fixes a configuration caching issue where Config.get() returns stale data after calling Config.update(). The fix ensures that:

  1. Updates are written to the correct file (opencode.json not config.json) that the auto-loader reads
  2. The config cache is cleared after writing, so subsequent reads reflect the updated configuration

How did you verify your code works?

I added a failing test case

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Hey! Your PR title Fix: Config Get returns stale data after Patch doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found one potentially related PR:

Related PR:

The other results are not relevant duplicates - PR #14743 is about Anthropic prompt caching (unrelated) and PR #20316 is about sandboxing configuration (different feature).

- Change config file path from config.json to opencode.json to match the
  auto-loader which reads from .opencode/opencode.json
- Add invalidate() call to clear config cache after writing
- Add integration test for patch then get config flow
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 2, 2026
@github-actions github-actions bot closed this Apr 2, 2026
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.

1 participant