-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement settings change subscriptions for service hot-reload #503
Copy link
Copy link
Labels
prio:mediumShould do, but not blockingShould do, but not blockingscope:large3+ days of work3+ days of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturespec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementation
Description
Summary
Implement a generic mechanism for services to subscribe to #settings message bus channel and react to runtime setting changes by rebuilding affected service instances (ProviderRegistry, ModelResolver, MemoryBackend, etc.).
Context
SettingsService already publishes change notifications to the #settings message bus channel when settings are written or deleted (see service.py:_publish_change()). However, no services currently subscribe to these notifications. Startup-time consumers build service instances once from config and never update:
ProviderRegistry.from_config(root_config.providers)— builds driver instancesModelResolver.from_config(root_config.providers)— builds model indexModelRouter(routing_config, providers)— builds routing strategycreate_memory_backend(config.memory)— builds memory backend
When a setting changes at runtime (e.g., provider API key rotated via the settings API), these services continue using stale config until restart.
Scope
- Create a
SettingsSubscriberprotocol or base class that services implement - Implement a listener on the
#settingsmessage bus channel that dispatches to registered subscribers - Each subscriber declares which
(namespace, key)pairs it cares about - On change: subscriber rebuilds the affected service and swaps it into AppState
- Thread-safe service swap (atomic reference replacement)
- Graceful handling of rebuild failures (log error, keep old instance)
Design Considerations
- Memory backend has
restart_required=True— change notification should flag this to the operator rather than attempting hot-reload - Provider services could be rebuilt without restart
- Coordination settings take effect per-request already (via ConfigResolver composed reads from feat: migrate existing config paths to read through SettingsService #497), so no subscriber needed there
Related
- feat: migrate existing config paths to read through SettingsService #497 (creates ConfigResolver, migrates controller-layer reads)
- feat: refactor structural data endpoints to read from SettingsService via JSON settings #502 (structural data JSON settings)
- feat: implement provider management (multi-auth, runtime CRUD, local providers) #451 (provider runtime CRUD — depends on this for hot-reload after provider add/edit/remove)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:mediumShould do, but not blockingShould do, but not blockingscope:large3+ days of work3+ days of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturespec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementation