fix: reduce flakiness in retrieval config integration test#437
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #437 +/- ##
=======================================
Coverage ? 91.06%
=======================================
Files ? 60
Lines ? 5072
Branches ? 775
=======================================
Hits ? 4619
Misses ? 257
Partials ? 196
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ff48fe3 to
8f07d61
Compare
notgitika
approved these changes
Apr 24, 2026
notgitika
left a comment
Contributor
There was a problem hiding this comment.
LGTM thanks for looking into this!
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.
Problem
The integration test
test_session_manager_with_retrieval_config_adds_contextis flaky (#432). It fails because the relevance score filter (relevance_score=0.7) drops retrieved memories when the semantic similarity between the query"What do I like to eat?"and the extracted preference about sushi scores below 0.7. The test failed 3/3 attempts (original + 2 reruns) in this CI run.CI logs confirm:
Retrieved 1 memoriesappears butRetrieved X customer context itemsnever does — the relevance filter drops the memory before context injection.Solution
Two changes to make the test more reliable:
Lower
relevance_scorefrom0.7to0.3Change query from
"What do I like to eat?"to"What sushi do I like?"— semantically closer to the stored preference, producing higher and more consistent relevance scores.Testing
The test validates the same invariant: retrieval config with LTM causes
<user_context>to appear in agent messages. The changes only reduce non-determinism in the relevance score path without weakening the assertion.