Skip to content

Conversation

@shuv1337
Copy link
Collaborator

@shuv1337 shuv1337 commented Nov 14, 2025

Note

Introduce config hot reload with PATCH /config, safe JSONC persistence (locking/backup/atomic writes), targeted invalidation/events, and refactor state to named registries.

  • Config:
    • Add hot-reloadable persistence: persist.ts (locking, backup/restore, atomic writes), write.ts (JSONC incremental edits), diff.ts (change detection), error.ts, backup.ts, lock.ts, hot-reload.ts, global-file.ts.
    • New Config.Event.Updated and config/invalidation.ts for targeted cache invalidation; Config.readFreshConfig() and refactor state via State.register.
    • Improve plugin handling: path-like resolution, merge file-discovered plugins after config, preserve scoped npm IDs.
  • Server:
    • Enhance PATCH /config (project/global scope), return merged config, publish config.updated, fan-out on global; enrich TUI toast messages.
  • State/Instance:
    • Add named state registry with State.register and State.invalidate(name, key?); Instance.invalidate, Instance.forEach; bootstrap invalidation setup.
    • Migrate modules to named state: agent, command, provider, mcp, lsp, format, plugin (with cleanup), file/watcher, tool/registry, file/index.
  • Docs & Tests:
    • Add specs/config-spec.md for PATCH /config.
    • Extensive tests for hot reload, JSONC writing, plugin resolution, and global/project scoping.

Written by Cursor Bugbot for commit e3d696e. This will update automatically on new commits. Configure here.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +116
const hotReloadEnabled = isConfigHotReloadEnabled()
if (hotReloadEnabled && input.scope === "global") {
await State.invalidate("config")
}
if (hotReloadEnabled && input.scope === "project") {
await Instance.invalidate("config")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Refresh cached config even when hot reload is off

Config.update now skips invalidating state when OPENCODE_CONFIG_HOT_RELOAD is not set to "true". In the default configuration the updated file is written, but the in-memory config (and dependent services like providers, agents, tools) remains cached, so subsequent Config.get() calls continue returning the old data until the process is manually restarted. The previous implementation always disposed the instance after an update, so this is a regression where the API reports success but the change never takes effect. Invalidate or reload the config regardless of the flag and keep the event-based invalidation as an optional fast path.

Useful? React with 👍 / 👎.

@shuv1337 shuv1337 merged commit 44217bb into integration Nov 17, 2025
7 checks passed
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.

3 participants