Repository navigation
fix(setup): retain symbolic-link skill destinations across the lifecycle - #3109
akushonkamen wants to merge 2 commits into
Conversation
setup followed a symbolic-link skill directory and wrote REA's skill
bundle into its target, while uninstall retained the same directory
("Skill directory is a symbolic link.") and update's maintenance plan
skipped it, so setup modified a location REA's own removal and
maintenance paths do not manage (fixes morluto#3057).
Align setup and doctor with the documented retention policy
(docs/installation.md "Diagnose, update, and remove"; the morluto#1816
precedent for a symlinked ~/.rea root): SetupSkill partitions selected
destinations into managed and symbolic-link roots, and planning,
installation, and identity reads consider only managed roots. An
all-links selection needs no install and stays byte-identical; mixed
selections install only into their managed roots. readInstalledSkillIdentity
reports the declined roots when nothing is managed, and doctor maps that
to a new "unmanaged" skill state whose detail names the link and whose
remediation replaces it instead of looping through rea setup. Uninstall
now shares the same reason string, and client configuration-file symlink
following is unchanged.
Validation: tests/boundary/filesystem/setupSkill.test.ts grew five
symbolic-link regressions. Verified against the pre-fix sources
(d901561): all five fail on the old code, 5 failed | 10 passed of 15,
with the mixed managed+link selection failing "expected 'stale' to be
'missing'"; with the fix, the file passes 15/15 and the related setup,
doctor, update, and skill-ownership subset (15 files) passes 197 tests;
npm run check:fast and npm run docs:check pass. No real-client
end-to-end run: the reproduction uses a temporary HOME, which the
boundary tests mirror.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
| const { managed } = await partitionSkillDestinations( | ||
| skillDestinations(home, clientIds, environment, platform), | ||
| ); | ||
| return Promise.all( | ||
| managed.flatMap(({ path: root }) => |
There was a problem hiding this comment.
Setup promises skipped installs
With a linked Claude Code root and a missing Codex root, canonicalSkillNeedsInstall returns true, but SetupPlan still lists an install_skill action for both roots. installCanonicalSkill now skips the Claude Code root, so users approve a plan that promises an install that will not happen.
Share the filtered destinations with planning, report the skipped path separately, and add a mixed-selection test through runSetup rather than only the install helper.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/application/SetupSkill.ts
Line: 289-293
Comment:
**Setup promises skipped installs**
With a linked Claude Code root and a missing Codex root, `canonicalSkillNeedsInstall` returns `true`, but `SetupPlan` still lists an `install_skill` action for both roots. `installCanonicalSkill` now skips the Claude Code root, so users approve a plan that promises an install that will not happen.
Share the filtered destinations with planning, report the skipped path separately, and add a mixed-selection test through `runSetup` rather than only the install helper.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Hi, the P2 on SetupSkill.ts looks legit to me. With a linked Claude Code root and a missing Codex root, the plan still lists install_skill for both roots while the installer quietly skips one, so the user approves something that won't fully happen. The fix would be sharing the filtered destinations with the planner and reporting the skipped path separately, plus a mixed-selection test through runSetup. I can put that together if you'd like. Would you add sx4im as a collaborator on your fork so I can push it? No worries at all if you'd prefer to do it yourself. If you're good with that and end up merging my fix, I'd appreciate a co-author line on the commit: Co-authored-by: Saim Shafique [email protected] |
Review PR morluto#3108 alongside the overlapping lifecycle proposal morluto#3109 on the current main baseline before verifying selected-root planning and mutation. Co-authored-by: Kaoru0822 <[email protected]>
Validate final selected roots and references before preview/approval and again before any client or Hopper change. Keep interactive proposals available for unselected clients and retain registration-only setup. Recheck at installation. Share typed directory observations across setup, identity, and maintenance. Report unmanaged paths and unknown reads with their reasons instead of missing or stale facts. Keep expected inspection failures in Result and retain cleanup failures. Propagate retained uninstall children and preserve ownership manifests. Validation: 205 related tests pass, including actual CLI preflight, lifecycle, retained bytes, selection and approval-change controls. Full static/docs checks pass. Four real CLI install/rerun/repair/uninstall workflows match main outcomes, with identical 9,758 output tokens per task; timing limits are recorded separately. The explicit unmanaged doctor reporting direction also incorporates the related proposal and issue analysis from PR morluto#3109. Co-authored-by: Kaoru0822 <[email protected]> Co-authored-by: akushonkamen <[email protected]>
|
Thanks for the investigation and for making unmanaged skill directories explicit. That reporting direction is now included in #3108, with your contribution credited in the follow-up commit. The integrated approach checks final selected skill roots and #3108 is now merged as |
Summary
When a client's
reverse-engineer-anythingskill directory is a symbolic link (skill manager or dotfiles repo linking~/.claude/skills/reverse-engineer-anythingto a shared copy), REA's skill lifecycle disagreed about the same directory:rea setupfollowed the link and wrote REA's bundle into the link target (replacing itsSKILL.md, addingSKILL.md.rea.backupandreferences/), doctor then reported the skillaligned, whilerea uninstallretained the same directory ("Skill directory is a symbolic link.") leaving every written file behind, andrea update's maintenance plan skipped it. Setup modified a location REA's own removal and maintenance paths do not manage.Fixes #3057
Problem and expected behavior
Smallest trigger: a symlinked client skill root plus
rea setup --client claude_code --yeswith the skill enabled (issue reproduction uses an isolated temporaryHOMEwithln -s ../../managed/rea .claude/skills/reverse-engineer-anything).Violated invariant: the documented policy — skill symbolic-link paths are "retained and reported rather than followed" (
docs/installation.md"Diagnose, update, and remove"; the same ruleUninstall.tsalready applied and the #1816 precedent for a symlinked~/.rearoot). Setup'sinstallCanonicalSkill/planning path never checked whether a selected destination root is itself a symlink, so it was the one lifecycle stage that wrote through it, and doctor compared identity through the link and reportedalignedfor a copy REA cannot remove or update.Expected behavior: setup, doctor, uninstall, and update treat a symbolic-link skill root uniformly — retain and report it, never follow it. An all-links selection plans no install and stays byte-identical; a mixed selection installs only into its managed roots; doctor names the link and points at replacing it instead of a
run rea setuploop that would still do nothing.Change and scope
src/application/SetupSkill.ts: newpartitionSkillDestinationssplits selected skill destinations into managed and symbolic-link roots vialstat(missing/unreadable roots stay on each caller's existing path).canonicalSkillNeedsInstallandcanonicalSkillFilesnow consider only managed roots, so an all-links selection plans noinstall_skillaction and no destination bytes change, and mixed selections write only their managed roots.readInstalledSkillIdentityreads only managed roots and, when every root is a link, returns the declined roots as the newsymbolicLinkRootsfield. A sharedsymbolicLinkSkillReasonconstant ("Skill directory is a symbolic link.") is exported for the lifecycle.src/application/Doctor.tsandsrc/application/DoctorScope.ts: the skillstateunion gains"unmanaged", produced when the identity carries declined roots (versionnull,symbolicLinkRootsnon-empty). Doctor's detail names the link paths and the remediation becomes "Replace the symbolic-link skill directory with a real directory, then run rea setup to install a managed copy." — replacing the previous"Run rea setup"loop that could never resolve a linked root.src/application/Uninstall.ts: the existing retained reason literal now references the sharedsymbolicLinkSkillReasonconstant; uninstall behavior is unchanged (the fix aligns setup/doctor to uninstall's long-standing rule, not the reverse).ClientConfigPath.ts. Registration-only setup (--skill=false) is unaffected.Existing pattern harvested: the fix reuses the repo's established "retained and reported rather than followed" symlink rule — uninstall's per-root
isSymbolicLink()check and its user-facing reason string (made into the sharedsymbolicLinkSkillReasonconstant), the #1816 precedent for declining a symlinked~/.rearoot, andexistingSkillDestinations' existing skip of linked roots — and applies the same rule to the last two lifecycle stages that lacked it (setup write path, doctor identity read), instead of introducing a new policy.Follow the contribution scope:
Contract and boundary impact
src/application/SetupSkill.tsskill destination partitioning, consumed by setup planning/installation and bysrc/application/Doctor.tsidentity reporting.rea doctor's skillstatefield widens from"aligned" | "stale" | "missing"to add"unmanaged", with a new remediation string. Setup's applied actions for a linked selection change frominstalled_skillto none (nothing planned, nothing applied); mixed selections apply fewer actions (managed roots only). No MCP tool catalog changes.lstat-based, so Windows junctions/symlinks resolve through Node'sisSymbolicLink()on the stat. Client configuration-file symlink following (ClientConfigPath.ts) is deliberately untouched.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
(Setup reads the skill roots with
lstatand, for managed roots only, writes the skill bundle — the same file writes setup always performed, now excluding link roots.)Evidence and regression coverage
tests/boundary/filesystem/setupSkill.test.tsadds five symbolic-link regressions — (1)keeps a symbolic-link skill destination byte-identical and plans no install, (2)reads no REA skill identity through a symbolic-link destination, (3)reports doctor skill state unmanaged when the selected destination is a link, (4)installs only into managed roots when a selection also contains a link, (5)answers doctor from a managed root even when the selection also carries a link(mixed-selection empty-root boundary).d901561) the same file fails 5 failed | 10 passed (15) — all five new regressions red, covering the issue's write-through, read-through, doctorstale, and mixed-selection paths; restoring the fix turns the same file green 15/15. The issue reporter's real-CLI outputs (aligned after write-through, uninstallretained, control on a regular directory) independently establish the failure mode on 6.4.0.skill.state: "unmanaged"with detail naming the link and a replace-the-link remediation; setup on a linked selection plans noinstall_skillaction; uninstall's retained reason text is unchanged in wording.HOME; the boundary tests mirror that layout). A linked-root run of the realrea setup/doctor/uninstallCLI by a maintainer or the reporter would close it.For evidence-bearing changes:
Validation performed
npx vitest run tests/boundary/filesystem/setupSkill.test.ts— with the fix: 15 passed (15). Against pre-fix sources (the four changed source files checked out from the parent commit, tests unchanged): 5 failed | 10 passed (15), the five new regressions red. Sources restored and the tree verified clean afterwards. (The contributor brief recorded the red side as 4 failed | 10 passed; this session's run observed 5 failed | 10 passed, which matches the commit message's own recorded validation — all five regressions fail on the old code.)npm run test:focused -- tests/boundary/filesystem/setupSkill.test.ts tests/boundary/filesystem/setupSkillCleanupOwnership.test.ts tests/boundary/filesystem/setupConfig.test.ts tests/boundary/filesystem/setupClientConfigCleanupOwnership.test.ts tests/boundary/filesystem/setupUnavailableProvider.test.ts tests/boundary/filesystem/doctorSystemHostFilesystem.test.ts tests/boundary/filesystem/generatedSkill.test.ts src/application/Doctor.test.ts src/application/Setup.configuration.test.ts src/application/Setup.planning.test.ts src/application/Setup.recovery.test.ts src/application/Setup.initialSnapshot.test.ts src/application/SetupInstallFailure.test.ts src/application/Update.test.ts tests/process-global/updateMaintenance.test.ts— 15 files passed, 197 passed (197).npm run check:fast— 2 successful, 2 total (turbo typecheck + lint; cache was bypassed with--forcefor a fresh run: 0 cached).npm run docs:check— exit 0 (readmeConsistency suite 5 passed).npx oxfmt --check src/application/Doctor.ts src/application/DoctorScope.ts src/application/SetupSkill.ts src/application/Uninstall.ts tests/boundary/filesystem/setupSkill.test.ts— all matched files use the correct format.HOME: the boundary tests mirror that filesystem layout; no real Claude Code client session was driven here.npm run check:pr: the full local gate is optional for changes of this width perAGENTS.md("optional for broad changes or CI diagnosis"); CI owns the full deterministic suite.scripts/check_comment_history.pyandscripts/check_brand_name.py, do not exist in this repository (verified by tree search in an earlier round); the repository's own gates above were run instead.git fetchshowedorigin/mainstill atd901561— no drift since validation, so no rebase was needed; the branch is a single commit on top of currentorigin/main.Compatibility, safety, and release
unmanagedwith a concrete remediation) — that is the fix, and users who want REA to manage the copy can replace the link as the remediation says.--skill=falseregistration-only setup is unchanged.lstat/isSymbolicLink()semantics, not from a run on Windows.unmanagedstate makes a previously hidden situation visible instead of misreportingaligned.references-directory link check). Left to maintainer arbitration; both cannot merge, and the direction difference (reportunmanaged+ replace-the-link remediation vs refusal) is the material delta to review.Before merge
type(scope): outcome.