Skip to content

Fix for cleared chat history reloaded by stateful cache managers #1076

Merged
pieroit merged 4 commits intocheshire-cat-ai:developfrom
lucapiccinelli:develop
May 12, 2025
Merged

Fix for cleared chat history reloaded by stateful cache managers #1076
pieroit merged 4 commits intocheshire-cat-ai:developfrom
lucapiccinelli:develop

Conversation

@lucapiccinelli
Copy link

Description

Fix for the issue #1075

From the Cat UI, when using file_system as a cache manager, if you wipe a conversation using HTTP DELETE /conversation_history and then do a browser refresh, the deleted conversation is loaded back from the cache.

The bug was introduced in this commit in the file websocket.py, commenting the line 48

I noticed that this commit also modified the test test_session_sync_while_websocket_is_open in the file core/tests/routes/test_session.py. I checked that uncommenting the line 48 in websocket.py was not breaking it. It doesn't.

Related to tests, test_cache_creation in core/tests/cache/test_core_caches.py was failing on a second test run. This happens also in the main branch, due to a dirty context issue. I then added a try/finally block to clear the context and fix the test.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@lucapiccinelli lucapiccinelli changed the title Develop Fix for cleared chat history reloaded by stateful cache managers May 6, 2025
@lucapiccinelli
Copy link
Author

Gentle ping 😁. Has anyone had a chance to look at this PR? Any feedback?

I'm available to help clarify things if needed.

Thank you.
Have a nice day.

@pieroit pieroit merged commit 3645d42 into cheshire-cat-ai:develop May 12, 2025
2 checks passed
@pieroit
Copy link
Member

pieroit commented May 12, 2025

Good catch thanks @lucapiccinelli also for taking care of the tests.
The websocket endpoint for sure needs a rethinking so it manages the connections without explicitly managing the StrayCat instance

@lucapiccinelli
Copy link
Author

2sling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants