LearnNewsExamplesServices
Frontmatter
id13821
titleRe-key FM auto-memory from checkout-path to agentId (root cause of orphan-on-path-change)
stateClosed
labels
enhancementaiarchitecturemodel-experience
assigneesneo-opus-grace
createdAtJun 21, 2026, 11:00 PM
updatedAtJun 22, 2026, 12:02 AM
githubUrlhttps://github.com/neomjs/neo/issues/13821
authorneo-opus-grace
commentsCount5
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 22, 2026, 12:02 AM

Re-key FM auto-memory from checkout-path to agentId (root cause of orphan-on-path-change)

Closed v13.1.0/archive-v13-1-0-chunk-5 enhancementaiarchitecturemodel-experience
neo-opus-grace
neo-opus-grace commented on Jun 21, 2026, 11:00 PM

Context

The root-cause lane behind #13190 (which reconciles the symptom). Surfaced while deciding the #13190 archive policy (V-B-A'd this session).

The Problem (V-B-A'd at dev)

FM auto-memory is checkout-path-keyedremoveAgentRepo's own docstring (ai/services/fleet/removeAgentRepo.mjs L28-29) states it directly: "the Fleet Manager's auto-memory is checkout-path-keyed — so deleting a path orphans memory keyed on it." The fragility: rows orphan on any path change, not just removal. The empirical ~1281-orphan precedent that motivated #13190 came from a path change, not an agent removal — which is the tell that the key itself is wrong, not just the removal flow.

Checkout-path is an unstable key: it changes on managed-root migration, repo-slug change, or any re-provisioning. agentId (the Fleet Manager agent identity, already the canonical key in MemoryService — metadata.agentIdentity + the AUTHORED_BY edge) is stable across all of those.

The Fix

Re-key auto-memory from checkout-path to agentId:

  • Write path: key new auto-memory rows by agentId (derive once at write, not the volatile path).
  • Migration: map existing checkout-path-keyed rows → agentId (the checkout→agentId derivation already exists via deriveAgentRepoPath / inspectAgentRepo), re-key in place.
  • Result: a path change no longer orphans anything; #13190's reconcile becomes a thin safety net rather than a load-bearing cleanup.

Acceptance Criteria

  • New auto-memory rows are keyed by agentId, not checkout-path.
  • A migration re-keys existing checkout-path rows to agentId (idempotent; archived rows preserved).
  • A path change (re-provision under a new path) orphans zero rows (the regression guard).
  • #13190's archive-reconcile still runs as a safety net (no regression).

Out of Scope

  • The #13190 archive-on-removal reconcile (the symptom lane — ARCHIVE policy decided: set archivedAt + orphanedByRepoRemoval).
  • The archiveMemoriesForCheckoutPath MC primitive (a #13190 dependency).

Related

  • Root-cause of: #13190 (symptom reconcile). Touches: removeAgentRepo (#13187), the FM remove facade (#13338), MemoryService (the keying). MC-owned (the keying + migration are Memory-Core decisions).

Live latest-open sweep: gh issue list --search "auto-memory re-key / keying" → only #13190 (the symptom) at 2026-06-21T20:59; no root-cause re-key issue.

Origin Session ID: 80932414-00dc-4d2e-96e6-d0bcf1529733

Retrieval Hint: query_raw_memories("FM auto-memory re-key checkout-path agentId root cause orphan path-change stable key #13190 symptom")