Fix: Implement hot-reload configuration for LLM and Embedding settings in advanced setup mode #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Changes to LLM and Embedding settings (provider, server address, API key) in advanced setup mode were not immediately applied when configuration was saved. The filter would continue using old cached configuration and ignore fresh user settings, requiring a full restart to pick up changes.
Root Cause
The inlet and outlet methods were only checking configuration persistence (reloading only when problems were detected) rather than force-reloading the latest configuration from the persistent store at the start of each request.
Solution
This PR implements hot-reloading by ensuring configuration is always refreshed from the persistent store at the start of each request:
Key Changes
Force Reload in Inlet/Outlet Methods: Modified both
_async_inlet_impland_async_outlet_implto callself._reload_configuration_safe(force_reload=True)at the start of each requestPublic Reload Method: Added a public
reload_config()method that can be called externally to force backend configuration reload:Configuration Save Integrity: Verified that both
set_valves()and_save_configuration_safe()properly update bothself.valvesandself.config["valves"]with proper backup/rollback functionalityCode Changes
Before:
After:
Testing
reload_config()method exists and worksImpact
File Modified:
adaptive_memory_v4.0.pyLines Changed: ~32 insertions, 20 deletions (minimal, surgical changes)
Result
LLM and Embedding settings changes in advanced setup mode will now be immediately applied when configuration is saved. Users no longer need to restart the system to pick up fresh configuration changes.
Fixes the issue where the filter would ignore fresh user config and continue using stale cached settings.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.