Skip to content

feat(config): hot-reload config on file changes#22010

Closed
tobias-weiss-ai-xr wants to merge 1 commit intoanomalyco:devfrom
tobias-weiss-ai-xr:feature/config-hot-reload
Closed

feat(config): hot-reload config on file changes#22010
tobias-weiss-ai-xr wants to merge 1 commit intoanomalyco:devfrom
tobias-weiss-ai-xr:feature/config-hot-reload

Conversation

@tobias-weiss-ai-xr
Copy link
Copy Markdown

Summary

  • Watch the opencode config file for changes and hot-reload without restart
  • Uses GlobalBus with 500ms debounce to avoid reloads during rapid edits
  • Calls Config.invalidate() to force fresh config load on next access

Test plan

  • Edit opencode config (e.g., change a model) while opencode is running — verify the change takes effect without restart
  • Make rapid successive edits — verify only one reload happens (debounce)
  • Delete and recreate the config file — verify it recovers correctly

Subscribe to file watcher events via GlobalBus and trigger
Instance.disposeAll() when opencode.json/opencode.jsonc/config.json
files change. Uses a 500ms debounce to avoid rapid reloads. This
causes the provider system and all per-instance state to be rebuilt
with fresh config on the next access.
@github-actions
Copy link
Copy Markdown
Contributor

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

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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 github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

Based on the search results, I found several potentially related PRs:

Potential Duplicates/Related PRs:

  1. PR feat(opencode) user theme auto-reload #21778 - feat(opencode) user theme auto-reload

    • Related: Implements auto-reload functionality for a different component (user themes), similar pattern of watching file changes and reloading without restart
  2. PR fix(skill): invalidate skill cache when SKILL.md files change on disk #19136 - fix(skill): invalidate skill cache when SKILL.md files change on disk

  3. PR feat: add /reload slash command #9871 - feat: add /reload slash command

    • Related: Provides reload functionality (though manual command-based rather than automatic file watching)
  4. PR fix(opencode): load .gitignore patterns in experimental file watcher #20980 - fix(opencode): load .gitignore patterns in experimental file watcher

    • Related: Implements file watching functionality, relevant to the config file watching mechanism

These PRs share similar concepts (file watching, cache invalidation, reload/hot-reload patterns) but don't appear to be exact duplicates of the config hot-reload feature. PR #22010 appears to be the unique implementation for config-specific hot-reload.

@github-actions
Copy link
Copy Markdown
Contributor

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 11, 2026
@github-actions github-actions bot closed this Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant