[PR #4285] PATCH /config hot-reload w/ selective cache invalidation (#14) #10928

Closed
opened 2026-02-16 18:15:41 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4285

State: closed
Merged: No


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.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4285 **State:** closed **Merged:** No --- 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.
yindo added the pull-request label 2026-02-16 18:15:41 -05:00
yindo closed this issue 2026-02-16 18:15:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10928