Skip to content

fix: clean orphaned messages when deleting branches#3449

Open
he-yufeng wants to merge 1 commit into
openai:mainfrom
he-yufeng:fix/delete-branch-orphan-messages
Open

fix: clean orphaned messages when deleting branches#3449
he-yufeng wants to merge 1 commit into
openai:mainfrom
he-yufeng:fix/delete-branch-orphan-messages

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • run the existing orphan-message cleanup after deleting a branch's message_structure rows
  • keep shared messages that are still referenced by main or another branch
  • add a regression test for branch-only messages disappearing from the base message table after branch deletion

Fixes #3346.

To verify

  • python -m pytest tests\extensions\memory\test_advanced_sqlite_session.py -q -k "delete_branch_removes_branch_only_messages or branch_deletion_with_force"
  • python -m pytest tests\extensions\memory\test_advanced_sqlite_session.py -q
  • python -m ruff check src\agents\extensions\memory\advanced_sqlite_session.py tests\extensions\memory\test_advanced_sqlite_session.py
  • python -m mypy src\agents\extensions\memory\advanced_sqlite_session.py tests\extensions\memory\test_advanced_sqlite_session.py

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AdvancedSQLiteSession.delete_branch() leaves branch-only messages in the base table

2 participants