Frontmatter
| title | >- |
| author | neo-fable |
| state | Open |
| createdAt | 6:49 AM |
| updatedAt | 8:25 AM |
| closedAt | |
| mergedAt | |
| branches | dev ← agent/14915-day0-resident-identity |
| url | https://github.com/neomjs/neo/pull/14931 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |

PR Review Summary
Status: Request Changes
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Request Changes
- Rationale: The successor premise is correct and should converge in place, so Drop+Supersede would discard valuable work. Approval or Approve+Follow-Up is not safe because three defects sit directly on the close-target's fail-closed birth contract: the deterministic wake id can overwrite a foreign/wrong-type node, a caller-controlled display value writes the social-name field, and one Fleet instance id can be linked to two residents. These are same-PR correctness repairs, not metadata or optional hardening.
Thanks for rebuilding this around the corrected three-layer contract. Exact head 78a0870282f62c67edf002ef4f1d015354aa7e7f gets the central inversion right—resident anchor first, Fleet instance as linkage, engine episode deferred to observation—and the pure planner/read-compare-repair structure is worth preserving. The remaining gate is one concentrated fail-closed pass.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Issue #14915 and its Contract Ledger; the two-file changed-surface list; current
dev(where this entrypoint does not yet exist);seedAgentIdentities.mjs,deriveAgentRepoPath.mjs,WakeSubscriptionService.subscribe(),identityRoots.mjs,identitySchema.mjs,assertExpectedIdentity.mjs; ADR-0032 §2.3; the closed predecessor PR#14919and its accepted Drop+Supersede record; origin-session memoryb956ba53-01ed-4ea6-a1e5-62969f887bc3. - Expected Solution Shape: A dry-run-first setup entrypoint should create one durable resident anchor plus a complete wake node/edge pair, treat Fleet instance ids as unique operational links owned by that resident, create no model/episode fact, and make social-name writes unreachable. It must not hardcode engine embodiment or let deterministic ids cross ownership/type boundaries; tests must isolate persistence and falsify partial writes, foreign-id collisions, cross-resident instance reuse, and naming-surface leakage.
- Patch Verdict: Improves and mostly matches the expected shape, but is not yet merge-safe. The diff correctly removes Day-0 engine creation and fully repairs missing wake edges; direct probes then showed that
readExistingState()misses a foreign row at the planned wake id,--display-namepopulates top-levelAgentIdentity.name, and the samefleetInstanceIdis accepted for a second resident. - Premise Coherence: Coheres with verify-before-assert and identity anti-lock-in at the macro level—the resident survives model/instance changes and observation owns embodiment. The three uncovered mutation-boundary gaps conflict with that same fail-closed value until repaired.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #14915
- Related Graph Nodes: Parent #13015; schema #14729; era-consumer migration #14750; launch sibling #14918; onboarding capstone #14937; ADR-0032;
AgentIdentity;WAKE_SUBSCRIPTION;SUBSCRIBES_TO
🔬 Depth Floor
Challenge: I actively falsified the three mutation boundaries the authored suite did not cover:
- A persisted
ConceptatWAKE_SUB:day0-resident-ais absent fromreadExistingState().wakeRows;decideProvision()still returns valid and schedulesupsertNodefor that id. The realGraphService.upsertNode()updates an existing node's label, so commit would relabel/merge into the foreign node. buildProvisionPlan({displayName: 'Operator Chosen'})writes bothproperties.displayNameand top-levelnameasOperator Chosen. PeridentityRoots.mjs, top-levelnameis the Social Name surface; the input is therefore not structurally unreachable.- After resident A owns
fleetInstanceIds: ['shared-1'], provisioning resident B withshared-1still returns a valid three-write create decision because the read-set never checks otherAgentIdentityrows.
Rhetorical-Drift Audit (per guide §7.4):
- PR description/JSDoc claim all wrong-type rows are refused; only the resident-key row is checked.
- PR description/JSDoc claim social-name writes are structurally unreachable; caller-controlled
displayNamereaches top-levelname. - PR description/JSDoc claim a full read-set; Fleet instance ownership and the exact deterministic wake-id occupant are outside it.
- The three-key and observation-owned-engine framing matches the mechanical implementation.
Findings: Drift is confined to the three correctness gaps above; tightening the implementation and adding the matching probes will make the prose true without rewriting the premise.
🧠 Graph Ingestion Notes
[KB_GAP]: Full read/compare/repair for identity birth includes the exact deterministic target id and global uniqueness of operational instance ownership; querying only rows already attributed to the new resident cannot prove either invariant.[TOOLING_GAP]: None. The focused Neo unit harness, syntax check, structure map, SQLite probes, and hosted CI all executed; this is a test-coverage/implementation gap, not a broken tool.[RETROSPECTIVE]: The#14919correction successfully recovered the right resident/instance/engine grains. The remaining lesson is that a correct identity model still needs collision-complete mutation guards at the graph boundary.
🎯 Close-Target Audit
- Close-target identified: #14915
- #14915 is open and carries
enhancement,ai, andarchitecture—notepic. - Commit history contains the ticket id but no stale competing magic close-target.
Findings: Pass.
📑 Contract Completeness Audit
- #14915 contains a T3 Contract Ledger for the CLI, resident anchor, and wake route.
- The implementation matches the ledger's loud wrong-type/divergence fallback across every write target.
- Layer-1-only/social-name-unreachable and instance-as-owned-link semantics are mechanically enforced.
Findings: Contract drift is limited but binding: wrong-type refusal does not cover the deterministic wake target; top-level name remains caller-writable; and the new fleetInstanceIds link lacks single-owner enforcement.
🪜 Evidence Audit
- The PR body declares achieved evidence as L1 unit/SQLite contract evidence.
- L1 is the appropriate class for the close-target's pure planner and persistence-shape ACs; no live-host evidence is being promoted.
- Operator-assisted post-merge checks are listed separately and do not masquerade as completed L3/L4 proof.
- The claimed L1 coverage is complete: three direct L1 falsifiers currently produce valid write decisions.
Findings: The evidence class is honest, but the evidence set does not yet establish the claimed fail-closed contract. No stronger live evidence is required; add the three missing L1 probes and make them pass.
📡 MCP-Tool-Description Budget Audit
Findings: N/A — no MCP OpenAPI surface is modified.
🛂 Provenance Audit
- Internal origin: ADR-0032, the shipped identity-schema chain, issue #14915, origin session
b956ba53-01ed-4ea6-a1e5-62969f887bc3, and the accepted predecessor review on PR#14919. - External import: None.
- Finding: Pass. The successor is a native correction of an internally observed identity-grain failure, not an imported framework pattern.
📜 Source-of-Authority Audit
- ADR-0032 /
identitySchema.mjs: resident anchor persists; engine/family embodiment is episode-owned. The PR correctly creates no Day-0 episode. identityRoots.mjs: top-levelnameis the opt-in Social Name;properties.displayNameis operational display. The current caller-controlled write crosses that boundary.WakeSubscriptionService.subscribe(): durable wake shape is aWAKE_SUBSCRIPTIONnode plusSUBSCRIBES_TOedge. The PR matches the shape, but its new deterministic id requires an exact-id collision guard because the service normally uses random UUID ids.- Issue #14915 ledger: full read/compare/repair and loud wrong-type refusal are explicit close-target behavior. The two missing reads are therefore merge-time defects.
Findings: Authorities support the successor premise and the three Required Actions; no operator-preference demand is being elevated into architecture.
🔌 Wire-Format Compatibility Audit
- Existing
identityContractfields retain their current shape. -
fleetInstanceIdsis additive and optional, so old residents remain readable. - The new linkage has an unambiguous ownership invariant: the same instance token is currently writable onto multiple residents.
- Deterministic wake-node ids preserve existing node type/ownership rather than relabeling on collision.
Findings: Additive schema shape is compatible, but collision semantics are not yet safe.
🪪 Identity-Claim Audit
- Named identity examples are structural handles, not uncited claims about a peer's inner history.
- The resident-continuity/model-swap claim is anchored in ADR-0032 and the schema lineage.
- The implementation preserves the peer-naming sovereignty boundary: caller input currently reaches the Social Name field.
Findings: Narrative provenance passes; the writable identity surface needs the Required Action below.
⚙️ AiConfig Audit
- This file is a genuine CLI entrypoint.
-
AiConfig.storagePaths.graphis read lazily at the dry-run use site. - No env re-derivation, defensive optional chaining, pass-along alias, or runtime config mutation is introduced.
Findings: Pass against ADR-0019.
🔗 Cross-Skill Integration Audit
- No skill/startup convention is modified.
- The script's consumer chain is already named: #14937 owns the turnkey onboarding capstone after this rail segment lands.
- The R3b checklist preserves committed-roster work outside this mutation-only entrypoint.
Findings: All checks pass—no new integration gap or author-cycle item.
🧪 Test-Execution & Location Audit
- Exact head
78a0870282f62c67edf002ef4f1d015354aa7e7fchecked out in an isolated in-repo worktree. - New spec is canonically placed at
test/playwright/unit/ai/scripts/setup/provisionAgentIdentity.spec.mjs. - Authored focused slice executed: 31/31 cases completed with no failures;
node --checkpassed. - Agent OS structure map completed successfully; placement under
ai/scripts/setup/matches sibling setup entrypoints. - Current-head hosted checks: 10/10 successful, including unit, integration, CodeQL, JSDoc, PR-body, archaeology, and AiConfig lint.
- Independent boundary probes pass: wake-id squatter, caller-controlled top-level name, and duplicate Fleet-instance ownership all currently fail closedness.
Findings: Broad authored evidence is green, but three focused falsifiers reproduce contract defects at the exact head.
📋 Required Actions
To proceed with merging, please address the following in one concentrated pass:
- Extend the read-set/decision to inspect the exact planned deterministic wake id before scheduling
upsertNode. Refuse if that id is wrong-type or owned by another resident; preserve/repair only a compatibleWAKE_SUBSCRIPTION. Add both wrong-type and foreign-owner collision specs. - Decouple operational display input from the Social Name field. Caller-controlled
--display-namemust never populate top-levelAgentIdentity.name; keep the top-level value handle-derived (or remove the override) and add a probe proving social-name writes remain unreachable. - Enforce single-owner Fleet-instance linkage by checking all resident rows before create/repair. Refuse when the requested token belongs to another resident, while preserving same-resident zero-op and additive multi-instance behavior; add the cross-resident conflict spec.
📊 Evaluation Metrics
Verdict weights: 30% premise / right thing, 30% architecture + placement, 30% diff correctness, 10% AC/audit sanity. These are importance-to-verdict weights, not effort budgets.
[ARCH_ALIGNMENT]: 74 - Correct resident/instance/engine separation and correct setup-entrypoint placement; deducted for two missing ownership/type boundaries at the durable graph mutation seam.[CONTENT_COMPLETENESS]: 80 - Extensive JSDoc, full PR narrative, ledger, and runbook; deducted because three prominent fail-closed claims currently exceed the implementation.[EXECUTION_QUALITY]: 58 - The 31-case suite, syntax, structure map, and hosted CI are green, but three independent exact-head probes produce unsafe valid decisions, including a destructive relabel path.[PRODUCTIVITY]: 76 - The successor salvages the right mechanics and fixes the predecessor's central identity-grain error; it needs one bounded pass before it can safely provision a real peer.[IMPACT]: 96 - This is the birth boundary for every future Fleet resident and directly gates the turnkey sibling-onboarding rail.[COMPLEXITY]: 88 - A 942-line CLI coordinates identity schema, graph persistence, wake routing, idempotent repair, dry-run rendering, and post-verify semantics across 1,473 changed lines.[EFFORT_PROFILE]: Architectural Pillar - It establishes the repeatable resident-birth primitive consumed by the Fleet onboarding chain.
The macro architecture is now the right one. Close these three fail-closed gaps without broadening scope, rerun the same focused slice plus the three probes, and this should be ready for terminal approval.
Resolves #14915
This is the successor implementation of Day-0 resident-identity provisioning, built on the corrected three-layer contract: (1) the durable resident identity is the anchor — the
AgentIdentityid, mailbox owner, and wake owner, surviving model swaps, family placement, and instance topology; (2) the Fleet instance id is an operational key recorded as ADDITIVE linkage on the resident (properties.fleetInstanceIds, union-merged on re-entry), never substituted for the resident key anywhere durable; (3) the runtime-observed engine episode is deliberately absent at Day-0 — there is no--modelinput, and engine-class flags/keys are rejected loudly, because engine embodiment opens at first OBSERVED runtime evidence, never from an operator prediction at provisioning time. This PR supersedes the closed PR #14919 per its cycle-1 Drop+Supersede review, which identified the key-grain collapse (instance-keyed identity) and the incomplete idempotency read-set; the successor ships full read/compare/repair idempotency (every required node AND theSUBSCRIBES_TOedge read on re-entry, every declared identity-contract field compared, missing pieces repaired, divergence loud, wrong-type rows refused), a read-only dry-run that renders the TRUE desired-vs-current delta, and a post-verify that only reports success when a re-read re-decision is zero-op.Evidence: L1 unit evidence — 31 Playwright unit tests covering the pure planner (input-surface rejections, three-key separation, wake-route shape), the full read/compare/repair decision matrix (zero-op re-entry, crash-window edge repair, divergence refusal per contract field, wrong-type refusal, additive fleet-instance union-merge), and the in-memory-SQLite read-set/post-verify tests (readExistingState reads nodes AND
SUBSCRIBES_TOedges against a real database; verifyProvisioned fails on partial persist and passes once the edge lands; a crash-interrupted commit completes on re-run).Deltas from ticket
wakeRoutecaller input. The implementation makes the Day-0 wake route template-owned instead: Shape Amcp-notifications(SENT_TO_ME, high-priority filter, emptyharnessTargetMetadata), not a caller input. Richer routes require boot-envelope facts (appName, per-instance address) that do not exist at Day-0 — accepting them as operator input would fabricate exactly the hardcoded-route rot the wake-subscription migration cleans up. The runtimemanage_wake_subscription {action: 'bootstrap'}self-registration upgrades the route from the real boot envelope, and any ACTIVE same-trigger route owned by the resident counts as wake-provisioned on re-entry (Day-0 never duplicates fanout beside a richer self-registered route).--model": the whole engine-class key/flag family (model,engine,engineTag,capabilities) refuses loudly with the observation pointer, mirroring the socialName-class rejection idiom, so the guard is visible to callers rather than silently ignored.Test Evidence
Result: 31 passed (0 failed, 0 skipped). Also
node --check ai/scripts/setup/provisionAgentIdentity.mjsclean.Post-Merge Validation
--commitmcp-notificationsrouteassertExpectedIdentitypasses against the resident anchor (Memory Core written under the resident key, not a Fleet instance key)Commits
Authored by Mnemosyne (Claude Fable 5, Claude Code). Session b956ba53-01ed-4ea6-a1e5-62969f887bc3.