Skip to content

Improve PATCH /config - Add hot-reload w/ selective cache invalidation (#15)#4303

Closed
shuv1337 wants to merge 37 commits into
anomalyco:devfrom
Latitudes-Dev:config-hot-reload
Closed

Improve PATCH /config - Add hot-reload w/ selective cache invalidation (#15)#4303
shuv1337 wants to merge 37 commits into
anomalyco:devfrom
Latitudes-Dev:config-hot-reload

Conversation

@shuv1337
Copy link
Copy Markdown
Contributor

Implements runtime configuration updates through a PATCH /config endpoint with optional hot-reload capability controlled by OPENCODE_CONFIG_HOT_RELOAD environment variable.

Changes

Features

  • PATCH /config endpoint for updating project or global configuration at runtime
  • File locking mechanism with 30s timeout to prevent concurrent write conflicts
  • Automatic backup and restore on configuration update failures
  • Config invalidation system that triggers targeted cache invalidation and event publishing
  • Event bus integration for config.updated notifications across project instances
  • Deep merge support for partial configuration updates with JSONC comment preservation

Infrastructure

  • New config write module with atomic file operations and validation
  • Lock file management for concurrent access control
  • Configuration diffing to detect actual changes before triggering invalidations
  • State-based hot reload that respects feature flag for backward compatibility
  • Integration with agent, provider, server, mcp, lsp and plugin systems for config subscription

Testing

  • Hot-reload test suite covering GET/PATCH workflows
  • Lock file management tests
  • Config write and persistence tests

Documentation

  • Complete PATCH /config specification with examples
  • Feature flag documentation for OPENCODE_CONFIG_HOT_RELOAD
  • Client integration guide with curl examples

Breaking Changes

None. Hot-reload is opt-in via environment variable. Default behavior maintains existing cache semantics.

Configuration

Set OPENCODE_CONFIG_HOT_RELOAD=true before starting server to enable runtime config updates without restart. Without this flag, disk writes persist but in-memory cache remains until process restart.

image

@shuv1337 shuv1337 changed the title PATCH /config hot-reload w/ selective cache invalidation (#15) Improve PATCH /config - Add hot-reload w/ selective cache invalidation (#15) Nov 17, 2025
@github-actions github-actions Bot force-pushed the dev branch 2 times, most recently from 917250b to f4593c6 Compare November 22, 2025 05:02
actions-user and others added 8 commits November 22, 2025 23:41
Resolve conflicts in:
- config/config.ts: Use resolveGlobalFile import and updated NamedError path
- plugin/index.ts: Keep State.register pattern with cleanup, update plugin versions
- provider/provider.ts: Keep State.register pattern for hot-reload support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update import to use @opencode-ai/util/error to match the NamedError
module relocation from dev branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@shuv1337
Copy link
Copy Markdown
Contributor Author

I don't see this getting merged any time soon so i'm just going to close it and maintain it in my own fork

@shuv1337 shuv1337 closed this Nov 26, 2025
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