Repository navigation
fix(kb): invalidate semantic and topic retrieval caches on every KB write (#20958) - #21049
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
Walkthrough
Pre-merge checks:
|
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
|
Landed on main through merge train #21348 as 5293da2 (merged 2026-11-12 08:19 Riga). Member head ce6840c is an ancestor of origin/main; no revert of it is on main. Content check on origin/main: |
Thinking Path
Semantic and topic retrieval caches could keep serving results after a knowledge-base write, so answers went stale. The fix keys the retrieval caches on the KB epoch and bumps it from one hook that every write path goes through, rather than patching each cache or each call site.
What Changed
autobot-backend/knowledge/retrieval_invalidation.py:invalidate_retrieval_cachesand@invalidates_retrieval_caches(invalidates infinally, so a failed write still invalidates).@invalidating_writesis applied at the composition pointknowledge/_composed.py, driven by a singleWRITE_ENTRY_POINTSlist.KBSynthesizer._index_documents.retrieval_invalidation_20958_test.py: entry points must keep the decorator, and the 26 raw vector-write sites are each classified.Verification
retrieval_invalidation_20958_test.pyfails if an entry point loses the decorator or a raw vector-write site is unclassified.update_fact, hence "Refs" rather than "Closes".Risks
Extra epoch bumps on writes cost one cache miss per write; no data is changed. Metadata-only writes (#20993) and the sync rebuild (#20992) remain uncovered until those issues land.
Model Used
Claude Sonnet
Issue Link
Refs #20958
Changelog fragment
Checklist
CLAUDE.mdmain(notrelease)🤖 Generated with Claude Code
Summary by CodeRabbit