mem0
mem0 copied to clipboard
Fix: Added missing logic to persist in db and return in PUT /config endpoint
Description
This PR restores the missing database save operation and return statement in the update_configuration function that were accidentally removed during a recent refactor (approximately 3 weeks ago when the PATCH endpoint was added below this PUT endpoint).
Bug: The update_configuration PUT endpoint (/config) was updating the in-memory updated_config dictionary but failing to:
- Persist changes to the database via
save_config_to_db() - Reset the memory client to apply new settings via
reset_memory_client() - Return the updated configuration to the client
This caused configuration updates to be lost on server restart and potentially inconsistent state in the memory client.
Fix: Re-added the three missing lines that save the configuration to the database, reset the memory client, and return the updated configuration object.
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
- [x] Manual testing: Verified that PUT
/configendpoint now persists configuration changes to the database and returns the updated configuration - [x] Code review: Confirmed the restored code matches the original implementation pattern used in the codebase
- [x] Regression check: Ensured the PATCH endpoint below this function remains unaffected by the changes
Test steps:
- Send PUT request to
/configwith updated configuration - Verify response returns the updated configuration
- Restart the server
- Verify configuration persists across restarts (database save works)
- Verify memory client uses new configuration (reset works)
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I have checked my code and corrected any misspellings
Maintainer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed