Skip to content

PATCH /config hot-reload w/ selective cache invalidation (#14) - #4285

Closed
shuv1337 wants to merge 0 commit into
anomalyco:devfrom
shuv1337:dev
Closed

shuv1337 wants to merge 0 commit into
anomalyco:devfrom
shuv1337:dev

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.

@shuv1337

Copy link
Copy Markdown
Contributor Author
image

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