feat(rag): per-user annotation signals for personalized RAG retrieval (#3240)#3610
Merged
mrveiss merged 2 commits intoDev_new_guifrom Apr 6, 2026
Merged
feat(rag): per-user annotation signals for personalized RAG retrieval (#3240)#3610mrveiss merged 2 commits intoDev_new_guifrom
mrveiss merged 2 commits intoDev_new_guifrom
Conversation
Owner
Author
Review fixes applied ✓
|
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.
Closes #3240
Summary
Adds per-user scoping to the RAG feedback and pattern learning system so individual user engagement (accept/reject source cards) biases retrieval for that user only, without polluting global patterns.
Changes
retrieval_learner.py—user_idparam added throughout; Redis stream keyrag:feedback:{date}→rag:feedback:{uid}:{date}; pattern keys namespacedrag:retrieval_patterns:{uid}:{hash};get_matching_pattern()uses 4-level fallback: user-exact → user-complexity-only → global-exact → global-complexity-onlyrag_service.py—user_idthreaded through_store_feedback_in_stream(),_emit_ranked_feedback(),_lookup_retrieval_pattern(),_record_retrieval_outcome(), andadvanced_search()api/knowledge_rag_feedback.py(new) —POST /knowledge_base/rag-feedbackendpoint for user-scoped annotation eventscore_routers.py— registers newknowledge_rag_feedback_routerKnowledgeResearchPanel.vue—acceptSource()andrejectSource()now call_emitAnnotationFeedback()which posts to the new endpoint withuser_idfromuseUserStoreTests
retrieval_learner_user_scoped_test.py(new) — 14 tests: stream key namespacing, pattern key namespacing, user-scoped lookup, global fallback, preference of user over global, low-confidence user pattern skipping,record_pattern_outcomeuser scoping, end-to-end cycleretrieval_learner_test.py— updated cursor key assertion for new key format