Harden retrieval and forgetting runtime paths - #65
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude Please review the whole pr with every decision tree this code has touched, previously and now. Please see every decision tree that affects the change from start to end. Please make a plan, see the code, make a decsison tree, see that code, review it, seee old code, review it, and trhen come to a fianl judgement. |
|
Claude finished @Atharva-Kanherkar's task in 3m 19s —— View job PR Review: Harden retrieval and forgetting runtime pathsPlan:
Decision Trees: Before → After1.
|
| Change | Test coverage |
|---|---|
Superseded filtering in retrieve |
test_retrieve_filters_superseded_records_by_default ✓ |
Admin opt-in include_superseded=True |
test_retrieve_can_include_superseded_records_for_admin_flows ✓ |
| Contradiction check status in write response | test_semantic_write_swallows_valueerror_from_contradiction_lookup updated ✓ |
Broad exception catch → status: "error" |
test_semantic_write_reports_programming_error_from_contradiction_lookup ✓ |
Forgetting report status: "completed" |
Integration tests updated ✓ |
Single-flight lock already_running |
test_overlapping_forgetting_requests_return_already_running ✓ |
| Post-resolve retrieval filters superseded | test_retrieval_hides_superseded_semantic_records_by_default ✓ |
memory.updated event from record_outcome |
test_record_outcome_emits_memory_updated_event ✓ |
Logger on_memory_updated format |
test_console_logger_formats_events updated ✓ |
Coverage is thorough. Every behavioral change has a corresponding test.
One gap: the FakeStore.get_all_records in test_forgetting_service.py now handles include_superseded but there is no explicit test asserting that the forgetting service's _scan_records passes include_superseded=True to the semantic store. The behavior is covered transitively through integration tests, but a unit test asserting the scan includes superseded semantic records would close this gap completely.
Final Judgement
Verdict: Approve with minor notes
The PR correctly addresses all four issues from #59:
- ✅ Superseded semantic memories filtered from default recall — correct and consistent across
retrieve,retrieve_by_vector, andget_all_records - ✅ Contradiction check status is now explicit (
completed/skipped/error) instead of an empty list - ✅ Forgetting cycle single-flighted with a per-process async lock
- ✅
memory.updatedevent emitted fromrecord_outcomeand wired into recorder + logger
The critical internal consistency fixes (_scan_records and find_likely_duplicates_batch opting into superseded records) are correct and necessary — without them, the new default filtering would have silently broken forgetting and duplicate detection.
Minor issues to be aware of:
retrieve_by_vectorwithinclude_superseded=Falsenow scans the full collection on every query (see note onsemantic_store.py:113-115). Fine at current scale; could become a bottleneck later.- The bare
except Exceptionin_safe_contradiction_lookupdowngrades programming errors from HTTP 500 to silentstatus: "error"in the response body — consider adding a server-side log line. - The
asyncio.Lockguard is per-process only; multi-worker deployments won't benefit.
| Branch
|
@claude is this issue mergeable now? |
|
Claude finished @Atharva-Kanherkar's task in 52s —— View job Mergeability Assessment
Yes — this PR is ready to merge. CIBoth checks pass (Tests ✅, Claude Code Review ✅). Vercel preview is Ready. Previous Review Follow-upsThe "Tighten issue 59 review follow-ups" commit addressed all three minor issues flagged in the earlier review:
All four behavioral changes from #59 are correct and fully tested. No blocking issues remain. |
Summary
already_runningresponse on overlapmemory.updatedfor procedural outcome recording and wire the shared contradiction detector/runtime paths consistentlyWhy
Issue #59 hardens the core runtime behavior for the MCP boundary. Before this change, superseded facts could still leak into retrieval, contradiction failures were indistinguishable from empty results, forgetting cycles could overlap, and procedural outcome updates changed state without emitting an observable event.
Validation
python -m py_compile api/app.py stores/semantic_store.py stores/procedural_store.py forgetting/contradiction.py forgetting/service.py runtime.py events/logger.py tests/test_api_runtime_edges.py tests/test_forgetting_integration.py tests/test_forgetting_service.py tests/test_logger.py tests/test_procedural_store.py tests/test_semantic_store.pymemory.updatedevent emission, and superseded semantic filtering after resolveCloses #59