Repository navigation
SWF(bug): refresh conversation LRU order on writes - #11
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This was referenced Nov 29, 2026
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.
Summary
Writing to a conversation (
update_metadata,add_items,remove_item) now refreshes its LRU position, so a full store evicts the least recently used conversation instead of the one just written.Root cause:
get()refreshes bothlast_accessand the eviction queue (Inner::order), but the three write paths refreshed onlylast_access. Capacity eviction pops fromorder, not by timestamp, so a written conversation kept its stale queue position. With capacity 2: create A, create B, write A, create C → A was evicted, B survived. This breaks the store's documented read-and-write LRU contract.Fix: the queue update
get()already does is pulled intoInner::touch_lru()and called byget()and by each successful write.remove_itemcalls it only when an item was actually removed, matching where it already updateslast_access. The diff touches only this bug; duplicate item IDs after delete and TTL on item delete are fixed in separate PRs.Test plan
Regression test
write_refreshes_lru!, one test per write (capacity 2: create A, create B, write A, create C; A must survive and B must be evicted).Before the fix (test commit only):
After the fix:
Whole conversation store suite, no regressions:
test result: ok. 9 passed; 0 failed.Try it:
(The test binary links NCCL/cuBLAS. On a host without CUDA libraries, point
LIBRARY_PATH/LD_LIBRARY_PATHat them first.)cargo fmt --all -- --checkATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests(the blueprint lint chain, ending withtypos, exited 0)bash scripts/check-license-headers.sh(4163 valid, 0 invalid)Notes for reviewers
Not tested: a live server run on real hardware.
conversation_store.rsis 408 lines, under the 500-line cap.CLA
Implemented in session Refresh conversation LRU order on writes
Review with Devin · Open in Devin Desktop