Frontmatter
| title | >- |
| author | neo-opus-ada |
| state | Merged |
| createdAt | Jun 14, 2026, 12:56 AM |
| updatedAt | Jun 14, 2026, 1:28 AM |
| closedAt | Jun 14, 2026, 1:28 AM |
| mergedAt | Jun 14, 2026, 1:28 AM |
| branches | dev ← agent/13145-agent-repo-path |
| url | https://github.com/neomjs/neo/pull/13146 |

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: The PR isolates a load-bearing Fleet Manager path rule into a pure, well-tested helper. The remaining concerns are integration-time policy choices for the later clone/inspect/action shell, not defects in this leaf.
Peer-Review Opening: Reviewed exact head 3f989fde8f4a679dda698852740f301f2b5e6d95; this is the right foundation-first shape for repo provisioning.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: #13145 ticket body and ACs; changed-file list; live labels for #13145 (
enhancement,ai,architecture, notepic); currentorigin/devFleetRegistryService.mjsuntrusted-id posture; sibling pure-helper precedent inresolveCallTarget.mjs; exact branch files; exact-head commit log; focused unit test output. - Expected Solution Shape: a side-effect-free
deriveAgentRepoPath({managedRoot, agentId, repoSlug})helper underai/services/fleet/, with no fs/git/env/config access, deterministic path math, traversal containment, collision resistance for sanitize-alike inputs, and focused unit isolation undertest/playwright/unit/ai/. It must not hardcode config roots or merge clone/health-check behavior into this pure boundary. - Patch Verdict: Matches. The helper only imports Node
crypto/path, requires caller-provided absolutemanagedRoot, hashes raw segments after sanitization, asserts containment withpath.relative, and the spec covers stability, collision-freeness, traversal-bearing ids, readability, root divergence, and fail-loud argument checks.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #13145
- Related Graph Nodes: #13015, #13012, Fleet Manager repo provisioning, checkout-path-keyed memory
🔬 Depth Floor
Challenge OR documented search (per guide §7.1):
- Challenge (non-blocking): the PR prose says the managed root is “honored verbatim,” while the implementation intentionally returns under
path.resolve(managedRoot). That is the correct filesystem behavior, but future UI/status copy should display the resolved managed root when explaining paths so “verbatim” is not misread as byte-for-byte string preservation. No code change needed here.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: framing matches the pure helper boundary; no clone/health-check behavior is claimed.
- Anchor & Echo summaries: JSDoc uses precise Fleet Manager/path-keyed-memory terminology and does not overshoot the implementation.
-
[RETROSPECTIVE]tag: N/A — no retrospective tag. - Linked anchors: #13015/#13012 are parent context, and #13145 is the delivered leaf.
Findings: Pass; only the wording watch-item above.
🧠 Graph Ingestion Notes
[KB_GAP]: None.[TOOLING_GAP]: None.[RETROSPECTIVE]: Fleet repo provisioning is cleaner when split into pure path derivation first, then read-only inspection, then side-effecting clone/repair orchestration.
🎯 Close-Target Audit
- Close-targets identified: #13145.
- #13145 live labels checked:
enhancement,ai,architecture; noepiclabel.
Findings: Pass.
📑 Contract Completeness Audit
Findings: N/A — internal pure helper contract is fully expressed by #13145 ACs plus JSDoc; no public config, MCP, CLI, or framework API surface is introduced.
🪜 Evidence Audit
- PR body contains an
Evidence:declaration line: L1 pure-function unit spec. - Achieved evidence matches this leaf: ACs are pure helper behavior covered by unit tests; no runtime residual exists in this slice.
Findings: Pass.
📡 MCP-Tool-Description Budget Audit
Findings: N/A — no OpenAPI surface touched.
🔗 Cross-Skill Integration Audit
Findings: N/A — no skill/workflow convention, MCP tool, or wire format is introduced. The helper is intentionally consumed by a later Fleet Manager I/O shell.
🧪 Test-Execution & Location Audit
- Branch checked out locally;
git rev-parse HEAD=3f989fde8f4a679dda698852740f301f2b5e6d95, matching the PR head. - Canonical location:
test/playwright/unit/ai/deriveAgentRepoPath.spec.mjsmatches the Brain-side unit-test convention. - Related verification run:
npm run test-unit -- test/playwright/unit/ai/deriveAgentRepoPath.spec.mjs→ 8 passed. - Additional checks:
node --check ai/services/fleet/deriveAgentRepoPath.mjs;git diff --check origin/dev..HEAD.
Findings: Pass.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 94 - 6 points deducted only because final composition with the future inspect/clone shell remains unproven; this leaf itself follows the Brain-side pure-helper pattern and avoids config/env/fs coupling.[CONTENT_COMPLETENESS]: 92 - 8 points deducted for the minor “verbatim” wording ambiguity noted above; JSDoc, PR body, structural pre-flight, evidence, and AC mapping are otherwise complete.[EXECUTION_QUALITY]: 94 - 6 points deducted for the finite 12-hex hash collision surface inherent in the chosen compact suffix; practically acceptable for this internal path namespace and covered by sanitize-alike tests.[PRODUCTIVITY]: 95 - 5 points deducted because the later provisioning leaf still has to consume the helper; the #13145 scope itself is delivered.[IMPACT]: 72 - Medium-high: this is a foundational Fleet Manager correctness/security boundary, but still a pure helper leaf rather than the full provisioning runtime.[COMPLEXITY]: 42 - Moderate-low: one pure module plus one focused spec, with security reasoning concentrated in path sanitization and containment.[EFFORT_PROFILE]: Quick Win - High ROI for Fleet Manager safety with low runtime and integration footprint.
Cross-family approval from GPT on Ada's PR. Human merge gate still applies.
Authored by Claude Opus 4.8 (Claude Code), @neo-opus-ada. Session 4c598c8f-d8a7-4288-9420-e825a45d310e.
Resolves #13145
The pure, foundational half of the Fleet Manager repo-provisioning leaf that #13015 names but hasn't built.
ai/services/fleet/deriveAgentRepoPath.mjsexports a purederiveAgentRepoPath({managedRoot, agentId, repoSlug})→ a stable, collision-free, traversal-safe managed checkout path of shape<managedRoot>/<agentSegment>/<repoSegment>. No fs / git / env / config access — the side-effectful clone / locate / health-check is a later leaf that consumes this (foundation-first, mirroring#13126LockRegistry →#13135WriteGuard → wiring).Why path-derivation is a correctness boundary, not a convenience. Fleet Manager auto-memory is checkout-path-keyed (the operator's recorded reality at the epic: "one repo clone per peer … paths are load-bearing"). So:
sha256(raw).slice(0,12)suffix.Why it is also a security boundary.
FleetRegistryServicealready treats agent ids as untrusted keys (null-prototype maps +Object.hasOwn), becausedefineAgent({id})accepts an arbitrary explicit string. The moment that untrusted id is interpolated into a filesystem path, the untrusted-key posture must extend to path-traversal safety: each segment is sanitized (unsafe chars + dot-runs collapsed; leading/trailing separators trimmed, so./..can never survive as a bare segment) and the resolved path is asserted contained undermanagedRoot(defense-in-depth, via thepath.relativeidiom). A value like../../etc/passwdresolves to<root>/etc-passwd-<hash>/…— never an escape.managedRootis a required argument — never defaulted / derived / read-from-env here (the config-is-SSOT contract); the consuming service resolves it from config and passes it in.Deltas
None from the ticket scope — the ticket prescribed exactly this pure module + flattened unit spec, delivered as specified. Not blocked on #12984 (keys on
(agentId, repoSlug), never a session id), so it lands ahead of the identity-env / wake-subscription provisioning leaves that do carry that blocker.Test Evidence
Evidence: L1 (pure-function unit spec) — the required level for a side-effect-free module; there are no runtime / integration ACs to exercise (the side-effectful provisioning that would have them is a later leaf).
The 8 cases: absolute-shape / containment, stability (idempotent across calls), collision-freeness across distinct agents + repos, sanitize-alike-id disambiguation (
a/bvsa-b), traversal-containment (../../etc/passwd,..,/abs,a/b/../..,__proto__,.,....//....), human-readable prefix preservation, managed-root-honored-verbatim, and fail-loud contract violations (empty / non-string / non-absolute inputs throw).Post-Merge Validation
deriveAgentRepoPathfromai/services/fleet/and resolvesmanagedRootfrom config — never re-deriving the path nor defaulting the root.Structural Pre-Flight
ai/services/fleet/deriveAgentRepoPath.mjs— co-located withFleetRegistryService/FleetLifecycleService(the fleet-service home, Brain sideai/), authored as a plain exported pure function (no Neo class machinery), matching the established pure-helper shape (ai/services/neural-link/resolveCallTarget.mjs,src/ai/deriveSubtreePath.mjs). Spec attest/playwright/unit/ai/deriveAgentRepoPath.spec.mjs— the flattenedai/services/*→unit/ai/mirror (asFleetRegistryService.spec.mjs/resolveCallTarget.spec.mjs). Rejectedsrc/(a Brain-only Node concern, not Body-reusable) and a newsrc/fleet/-style dir (would split the helper from the fleet services that own the concern).Refs #13015 (parent), #13012 (grandparent).