Skip to content

feat(enrichment): give deferred/background facts a KG node (Inline parity) - #119

Merged
njfio merged 1 commit into
mainfrom
feat/deferred-fact-kg-node
Jul 23, 2026
Merged

njfio merged 1 commit into
mainfrom
feat/deferred-fact-kg-node

Conversation

@njfio

@njfio njfio commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Closes the one correctness gap the final whole-branch review of #117 flagged: deferred/background fact-memories were written to storage + state + the scoring corpus but lacked the knowledge-graph memory node that the Inline path (store_with_report) adds — so graph-based retrieval over deferred facts differed from Inline.

Fix

store_fact_shared now runs the same plan_memory_node_update → apply_memory_node_plan → edge-detection sequence the Inline path uses (the KG is Arc<RwLock>, so it's reachable from the shared enrichment context), best-effort (a KG failure degrades graph coverage of that fact but never fails the store). Lock discipline: these KG read/write locks are short and run after apply_resolution_shared has released its KG write lock (sequential in enrich_one), so no nesting/deadlock.

The only remaining Inline-vs-deferred divergence is temporal tracking + analytics events — owned, non-Arc subsystems the shared path can't reach; both are best-effort observability, not retrieval. Spec + doc updated to reflect the closed gap.

Tests

Regression enrich_one_gives_deferred_fact_a_kg_node (asserts kg.get_node_for_memory("turn1::fact0") is Some — None pre-fix). 494 lib tests pass, clippy --all-targets clean, fmt clean.

🤖 Generated with Claude Code

…rity)

The final review flagged that deferred fact-memories lacked the KG memory-node
the Inline path adds, so graph-based retrieval over them differed. store_fact_shared
now runs the same plan_memory_node_update + apply_memory_node_plan + edge detection
(KG is Arc, so reachable from the shared enrichment context), best-effort. Only
temporal/analytics remain divergent (owned non-Arc subsystems; observability only).
Regression test enrich_one_gives_deferred_fact_a_kg_node. 494 lib tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@njfio
njfio merged commit bf15585 into main Jul 23, 2026
17 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant