LearnNewsExamplesServices
Frontmatter
id10153
titleLazy back-fill: Memory + Session nodes for pre-migration Chroma rows
stateClosed
labels
enhancementaiarchitecturecore
assigneestobiu
createdAtApr 21, 2026, 11:31 AM
updatedAtApr 22, 2026, 2:00 PM
githubUrlhttps://github.com/neomjs/neo/issues/10153
authortobiu
commentsCount1
parentIssue10143
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[x] 10151 DreamService: deterministic ingestion phase for Memory + Session graph nodes
blocking[]
closedAtApr 22, 2026, 1:21 AM

Lazy back-fill: Memory + Session nodes for pre-migration Chroma rows

Closed v13.0.0/archive-v13-0-0-chunk-5 enhancementaiarchitecturecore
tobiu
tobiu commented on Apr 21, 2026, 11:31 AM

Lazy back-fill: Memory + Session nodes for pre-migration Chroma rows

Context

Parent sub-epic (#10143) phase 3. Phase 1 adds forward ingestion; phase 3 handles historical Chroma rows (8246 memories / 794 summaries at filing).

The Problem

Forward-only ingestion leaves permanent asymmetry: mailbox IN_REPLY_TO or identity AUTHORED_BY references to pre-migration artifacts have dangling targets. Eager back-fill at deploy time is bounded but expensive; lazy amortizes cost.

The Architectural Reality

  • Historical memories in neo-agent-memory; summaries in neo-agent-sessions. Total ~9040 rows.
  • Graph schema (post-phase-1) has Memory/Session node types; Chroma-ID → node mapping is deterministic.
  • graphDigested: true on summaries is the existing per-artifact processing flag — pattern to match.

The Fix

  • New marker property on Memory/Session nodes: backfilled: true (vs. liveIngested: true)
  • Lazy trigger: graph addEdge with missing target runs single-row ingestion synchronously, then completes the edge
  • Optional batch-priming CLI (ai/scripts/priorityBackfill.mjs) — eager back-fill for high-traffic sessions (e.g. last 30 days). Opt-in.

Acceptance Criteria

  • addEdge with missing target triggers lazy ingestion; edge completes atomically
  • backfilled: true marker distinguishable from live-ingested nodes in queries
  • Graph integrity check: no dangling edges post-shipping, even across historical boundary
  • CLI priority-backfill script documented
  • Performance observability: lazy ingestion latency instrumented; SLO defined post-phase-1 baseline, not pre-hardcoded

Out of Scope

  • Eager full-corpus back-fill at deploy (cost-prohibitive)
  • Re-running extractor on historical sessions for provenance edges (opportunistic; not required)
  • Deletion/archival policy for old nodes (separate concern)

Avoided Traps

  • Eager back-fill. Rejected. 9040 rows × ingestion + potential re-extraction = substantial deployment stall.
  • Forward-only (no back-fill). Rejected. Permanent dangling edges break invariants; downstream consumers each have to special-case null targets.

Related

  • Parent: #10143
  • Blocked by: phase 1 (need mapping logic)
  • Files: graph edge-creation service, ai/scripts/priorityBackfill.mjs (new)

Origin Session ID: 71dc3cd8-d39d-48e1-ac62-e240ca67d1a5

tobiu added the enhancement label on Apr 21, 2026, 11:31 AM
tobiu added the ai label on Apr 21, 2026, 11:31 AM
tobiu added the architecture label on Apr 21, 2026, 11:31 AM
tobiu added the core label on Apr 21, 2026, 11:31 AM
tobiu added parent issue #10143 on Apr 21, 2026, 11:33 AM
tobiu marked this issue as being blocked by #10151 on Apr 21, 2026, 11:33 AM
tobiu cross-referenced by #10143 on Apr 21, 2026, 3:06 PM
tobiu cross-referenced by #10158 on Apr 21, 2026, 3:23 PM
tobiu cross-referenced by PR #10161 on Apr 21, 2026, 4:36 PM
tobiu cross-referenced by #9999 on Apr 21, 2026, 7:03 PM
tobiu cross-referenced by #10145 on Apr 21, 2026, 8:43 PM
tobiu cross-referenced by PR #10165 on Apr 21, 2026, 8:59 PM
tobiu assigned to @tobiu on Apr 21, 2026, 10:28 PM
tobiu
tobiu Apr 21, 2026, 11:02 PM

Input from Antigravity (Gemini 3.1 Pro):

✦ # Epic Review by Antigravity (Gemini 3.1 Pro)

  • Stage 1 — Roadmap Fit: ✅ Vital for the transition to Graph-first Memory artifacts without breaking historical provenance or causing a deploy-time stall.
  • Stage 2 — Approach Elegance: ✅ The lazy-evaluation model for backfilling on addEdge is highly elegant. It amortizes the cost of 9040 rows beautifully, while priorityBackfill.mjs allows optional batch-warming.
  • Stage 3 — Sub-Structure Coherence: ✅ This ticket is highly focused; its ACs define a clear, self-contained atomic delivery.
  • Stage 4 — Prescription Layer: ✅ Fixing the dangling edge problem exactly at the addEdge boundary is the right substrate-level interception point.
  • Stage 5 — Avoided Traps Completeness: ✅ Properly identifies the extremes of Eager full-corpus and Forward-only as catastrophic/expensive, hitting the lazy sweet spot.

Verdict: Greenlight

Origin Session ID: ada4aecb-60fc-4b25-a76b-cb92600835a2

tobiu cross-referenced by PR #10171 on Apr 22, 2026, 12:47 AM
tobiu cross-referenced by #10172 on Apr 22, 2026, 1:19 AM
tobiu referenced in commit 8f52831 - "fix(ai): recover orphaned .draining file from SIGKILL edge case (#10153) on Apr 22, 2026, 1:19 AM
tobiu referenced in commit 3dbea00 - "feat(ai): lazy back-fill for Memory + Session graph nodes (#10153) (#10171) on Apr 22, 2026, 1:21 AM
tobiu closed this issue on Apr 22, 2026, 1:21 AM