Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 14 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are these changes needed?
Two concurrent
EventLogWriter.persist_dropped()calls can list the same existing segments and select the same next filename. Replacing that file withwrite()silently loses one complete batch, including when the writers share aSqliteKnowledgeStore.Append each serialized batch using the existing atomic
KnowledgeStore.append()contract and terminate it with a newline. Writers that select the same segment then retain both batches as valid JSONL. Numeric segment allocation and final snapshot replacement remain unchanged; concurrent batches may appear in either append order.The regression forces both public
list()calls to return their snapshots before either writer persists. It exercises real memory, disk, and SQLite backends, checks two multi-event batches, and verifies subsequent dropped and final events still load in order. All three cases fail on basecdc37c1845d9ef63c80263154b423ae3794d7b00because one batch disappears, and pass with this change.Local validation with Python 3.12.12 on Windows:
python -m pytest test/knowledge -q: 68 passed, 27 skipped (26 existing POSIX-only cases and the Redis module, whose dependency is absent).python -m ruff check --no-fix ag2/knowledge/log.py test/knowledge/test_knowledge.pyandpython -m ruff format --check ag2/knowledge/log.py test/knowledge/test_knowledge.py: passed with Ruff 0.16.10.git diff --check: passed.The full repository suite, full pre-commit/mypy pipeline, Redis service, and cross-process filesystem behavior were not exercised locally. No model/provider calls were made.
Related issue number
Fixes #3482.
Checks
AI assistance
Codex assisted with the diagnosis, code, regression test, PR text, and an independent agent review. The diff and claims were checked against the source and the observed failing/passing test results.
reviewed and tested locally.