mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Fix: Added missing logic to persist in db and return in PUT /config endpoint

Open sshenoy7 opened this issue 3 weeks ago • 1 comments

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:

  1. Persist changes to the database via save_config_to_db()
  2. Reset the memory client to apply new settings via reset_memory_client()
  3. 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 /config endpoint 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:

  1. Send PUT request to /config with updated configuration
  2. Verify response returns the updated configuration
  3. Restart the server
  4. Verify configuration persists across restarts (database save works)
  5. 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

sshenoy7 avatar Nov 07 '25 14:11 sshenoy7

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 07 '25 14:11 CLAassistant