Skip to content

fix(setup): refuse linked skill installation directories - #3108

Merged
N0zoM1z0 merged 8 commits into
morluto:mainfrom
geekwolf:fix/skill-symlink-installation
Oct 14, 2026
Merged

N0zoM1z0 merged 8 commits into
morluto:mainfrom
geekwolf:fix/skill-symlink-installation

Conversation

@geekwolf

@geekwolf geekwolf commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prevent setup from writing through a linked skill root or references directory. Validate the final selected destinations before preview/approval, again before any client/Hopper changes, and at skill installation. Fixes #3057.

Problem and expected behavior

Setup could write into a symbolic link's target. The initial PR refused the skill write, but combined setup still configured the client first. An already canonical linked copy also appeared installable/aligned. Doctor must distinguish unmanaged directories and unreadable observations from missing files; retained uninstall files must remain reported as retained.

Change and scope

Shared typed directory observations and single-pass canonical/read facts own the policy. Every selected managed file remains examined after a mismatch or expected read failure; observed metadata and all unreadable paths survive stale/absent manifests. Cleanup/resource failures retain their owner. Duplicate manifest reads are removed. Absent installed files are classified before any bundled-byte comparison, so source-only initial snapshots do not require generated artifacts. Final selection is admitted before side effects, preserving interactive choices for unselected clients and registration-only --skill=false. Doctor reports unmanaged/unknown with paths, reasons and alternatives. Update excludes linked roots/references; uninstall propagates retained child outcomes and preserves ownership manifests.

The explicit unmanaged doctor direction also incorporates #3109, credited in the follow-up commit. This is an ordinary correction within existing installation authority; a new capability scope decision is not applicable.

Contract and boundary impact

  • Owner: shared skill filesystem inspection, consumed by setup/doctor/update; uninstall owns aggregation of retained cleanup.
  • CLI/MCP: existing setup failure code skill_install_failed; doctor adds explicit unmanaged/unknown skill states and optional issues. Public stdio MCP doctor consumers were tested.
  • Providers and Evidence: no target analysis or provider protocol changes. Paths, known installed metadata, inspection reasons and cleanup ownership remain visible.
  • Selection and authority: only final selected destinations block setup; --skill=false remains available. Readiness/freshness does not establish permission to install.
  • Installation: normal directories retain install/rerun/repair behavior. Linked directories require regular destinations or registration-only setup. Generated skill/catalog outputs are not committed.

Expected effects: reads selected existing files; normal approved setup may write skill/configuration files and use existing Hopper installation behavior. No new provider, target execution, instrumentation or protection recovery is added.

Evidence and regression coverage

  • Clean main ec67aebed: three original regressions fail; initial PR: 19 focused tests pass. Two additional actual-CLI preflight tests fail on the initial PR because it creates Claude configuration before refusal.
  • Final selected setup returns needs_human, code: "skill_install_failed", and appliedActions: [] for unsafe roots/references. Doctor reports identity.skill.state: "unmanaged"; unreadable reads remain unknown with reasons.
  • Tests cover target bytes/link preservation, normal install/rerun/repair, registration-only setup, retained manifests, rollback, permissions, unselected-client choices and directory changes during approval.
  • No arbitrary concurrent directory-swap containment claim. Native Windows execution of this follow-up, real client-agent sessions, global package update and native Hopper execution remain unverified locally. The original author reported Windows junction coverage for the initial patch.

Validation performed

Final reviewed head 36b93d512, based on main 29d3dcb7e. Linux / Node 24.18.0 / npm 11.16.0:

  • Original follow-up: 16 files / 205 passes; latest-main lifecycle, actual stdio MCP doctor, update maintenance and CLI: four files / 95 passes, repeated after main synchronization.
  • Review uncovered early mismatch/first-error/absent-manifest exits hiding later unreadable references. Three real permission regressions fail on a03e6bf9c. Related selection: 17 files / 217 passes.
  • Follow-up f4cca100d exposed an own source-CI regression: missing installed files unnecessarily requested generated bundled bytes. A clean no-dist/no-skills checkout reproduces exactly 5 passes / one failure in setupEnvironment; the final absence-first correction passes all six. Full no-artifact source suite: 508 files / 7,446 passes / eight existing platform/condition skips. Production source matches final head byte-for-byte. Final focused environment/filesystem/cleanup/actual CLI/MCP selection: five files / 41 passes.
  • Full npm run check passes for the single-pass follow-up; final absence correction passes check:fast and git diff --check. Earlier docs:check (five consistency tests) passes. The identity-reader complexity warning is resolved. Module length remains one nonblocking warning (585 nonblank lines); related filesystem ownership stays in one module, with no forwarding layers or relaxed rules.
  • Four equivalent public CLI install/rerun/repair/uninstall tasks succeed on baseline/fixed isolated profiles. Each four-call task emits 9,758 o200k output tokens (9,850 for the explicit CLI transcript proxy). Main cold/warm: 9.60/8.04 s, CPU 10.05/9.01 s, family RSS 375/357 MiB. Fixed: 7.71/7.45 s, CPU 8.88/8.52 s, RSS 350/385 MiB. Individual trials with isolated Node compile caches and warm OS caches; no speedup or billed/whole-agent token reduction claim.
  • Final 36b93d512 compared against a03e6bf9c: four equivalent complete CLI tasks keep identical 10,668 output tokens (10,760 explicit transcript proxy). Before cold/warm: 10.70/9.88 s, CPU 11.74/10.58 s, RSS 390/385 MiB; fixed: 10.30/10.04 s, CPU 11.08/10.93 s, RSS 386/351 MiB. Individual trials, isolated compile caches, warm OS caches; no speedup, statistical equivalence or billed-token claim.
  • Two-CPU / 8-GiB sampled-family-RSS guard; peak verification about 4.4 GiB, no guard stop. Probes used owned profiles and minimal child environments with HOME omitted.
  • Prior a03e6bf9c CI passes all five shards, static/source/docs/build and all four native package platforms. Its review finding is corrected and resolved with regression evidence. Previous main PCAP blocker is repaired upstream in 1341e8c83 (clean main: 20 passes); duplicate repair PR test(pcap): expect the producer's final stdout newline #3257 was closed as already incorporated. Greptile passed f4cca100d with no remaining threads, but its own source-CI failure is fixed above. Final 36b93d512 CI run 38528527903 passes all five shards, source/static/docs/build, four native package platforms and aggregate gates. Greptile passes, with no unresolved review threads. This is current-head validation.

Compatibility and release

No dependency, package/release metadata or target-format change. Existing normal setup calls keep their behavior; linked skill directories now receive actionable refusal. Transport credentials and ambient environments are not persisted. No generated artifacts are committed.

Before merge

  • Concrete problem, linked issue and resolved existing installation authority.
  • Focused outcome, Conventional Commit title and reviewed final diff.
  • Observable CLI/MCP behavior, meaningful failure coverage and owning docs updated.
  • Evidence and verification limits preserved.
  • Required CI and review pass for the current head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High impact] The PR appears safe to merge, subject to the required checks passing for the current head.

Summary

Setup refuses linked skill roots and references directories before approval, before client or Hopper changes, and during installation.

  • Setup checks selected skill paths before making changes.
  • Doctor separates unmanaged skill paths from unreadable files.
  • Uninstall reports retained skill files as retained.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Final setup selection] --> B{Selected skill directories allowed?}
  B -->|No| C[Refuse without changes]
  B -->|Yes| D[Preview or approval]
  D --> E{Directories still allowed?}
  E -->|No| C
  E -->|Yes| F[Apply selected client and Hopper changes]
  F --> G[Check directories and install skill]
Loading

Reviews (7) · Last reviewed commit: "fix(setup): recognize absent skill files..." · Reviewed by Greptile

@geekwolf
geekwolf force-pushed the fix/skill-symlink-installation branch from 47e6cdb to 4263051 Compare October 14, 2026 04:31
N0zoM1z0 and others added 3 commits October 14, 2026 05:03
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]>
Include current main before final CI; setup directory, doctor, and uninstall
owners are unchanged by the intervening unrelated main corrections.

Co-authored-by: Kaoru0822 <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Independent follow-up verification is complete at ef45d981c, integrated with main 7375ab6e3.

The original change prevents writes into linked skill/root-reference directories, but combined setup still planned an install and configured the client before refusing the skill. I reproduced both root and references cases through the real compiled CLI in isolated profiles. Uninstall preserved linked reference bytes and its ownership manifest but incorrectly returned skipped with a message saying the managed files were removed.

The follow-up now:

  • checks final selected directories before preview/approval and again before any client or Hopper change, with the installation boundary retaining its own check;
  • preserves interactive Codex/shared choices when an unselected Claude directory is linked, plus registration-only --skill=false;
  • uses shared typed directory observations and canonical-read results for setup, doctor and update selection; linked/non-directory paths are unmanaged, unresolved reads are unknown, with paths/reasons and actionable alternatives;
  • returns retained uninstall outcomes when children remain, preserves ownership manifests and deduplicates repeated cleanup reasons.

This keeps the issue's refusal direction and incorporates the explicit doctor reporting idea from competing PR #3109, credited in the follow-up commit.

Validation:

  • Clean main ec67aebed: the original three new regressions fail; initial PR: 19 focused tests pass. Two additional real-CLI preflight regressions fail on the initial PR because Claude configuration was created before refusal.
  • Final related 16-file selection: 205 tests pass. Includes real filesystem/CLI, interactive selection semantics, changes during approval, unreadable references, update selection, rollback and retained cleanup. After synchronizing new main, client lifecycle, production stdio MCP doctor, update maintenance and selected-skill CLI consumers pass another 95 tests across four files.
  • Full npm run check, docs:check (five consistency tests), and synchronized check:fast pass. Two new nonblocking lint warnings concern the existing SetupSkill module length and identity-reader complexity; the directory policy and unknown/read failure semantics are nevertheless owned together rather than repaired in CLI projection. No lint control was relaxed.
  • Equivalent complete public CLI install/rerun/repair/uninstall workflows succeed on main and fixed with identical 9,758 o200k output tokens per four-call task (9,850 for an explicit full CLI transcript proxy). Main cold/warm: 9.60/8.04 s, CPU 10.05/9.01 s, family RSS 375/357 MiB. Fixed: 7.71/7.45 s, CPU 8.88/8.52 s, RSS 350/385 MiB. These are individual trials and isolated Node compile caches; OS disk caches remain warm. No speedup, statistical equivalence, or billed/whole-agent token reduction is claimed.

Linux, Node 24.18.0/npm 11.16.0; two CPUs and 8-GiB sampled family RSS threshold. Peak across verification was about 4.4 GiB, with no guard stop. All mutation probes used owned profiles and minimal process environments (HOME was omitted, not repurposed); an initial inherited-home dry-run was stopped by a target-path check before any writes. Native Windows execution of this follow-up, a real client-agent session, global package update, and arbitrary concurrent directory-swap containment are not claimed. Current-head CI/review remain the merge gate.

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Current-head CI is blocked by an unrelated new main test failure. Shard 5 reports 1 failure, 1,178 passes and 22 skips; the other four shards were cancelled.

A clean checkout of this PR's integrated main baseline 7375ab6e3 independently reproduces exactly the same failure: tests/boundary/pcap/pcapProvider.test.ts, 19 passed / 1 failed. This PR changes neither the PCAP producer/test nor process supervision. Main commit 23c70d674 introduced the cleanup regression test. Its stub emits printf '%s\n', while line 218 expects CAPINFOS_OUTPUT without that final newline. The assertion exits before mayClean = true, so the injected unresolved cleanup also fails the finalizer. Production correctly preserves the raw output.

The smallest upstream repair is to expect ${CAPINFOS_OUTPUT}\n for the capinfos stage; do not trim production evidence or weaken cleanup checks. Static checks, source tests, package build, generated docs and Greptile pass for this head. Cancelled checks are not treated as passes. I am keeping this unrelated repair out of the setup PR and waiting for the upstream gate to be restored.

Integrate latest main, including 1341e8c's exact capinfos stdout expectation
and unconditional release of the injected cleanup failure. Setup directory,
doctor, and uninstall owners are unchanged by this synchronization.

Co-authored-by: Kaoru0822 <[email protected]>
Comment thread src/application/SetupSkill.ts Resolved
N0zoM1z0 and others added 2 commits October 14, 2026 07:11
Inspect every selected managed file after a freshness mismatch or read failure.
Keep all unreadable paths visible even when the manifest is stale or absent,
while preserving known metadata and exact cleanup/resource failure ownership.

Read the manifest once in the shared inspection and consume those facts in
doctor identity instead of performing a second pass that can hide failures.
After a mismatch, skip redundant canonical-content comparisons while still
examining subsequent file reads.

Three real permission regressions fail before the change for aligned, stale,
and missing manifests. All 217 related filesystem, CLI/MCP, planning, recovery
and maintenance tests pass after it, as does the complete static check.

Co-authored-by: Kaoru0822 <[email protected]>
An absent installed file already establishes noncanonical state. Avoid reading
generated canonical artifacts for that comparison, while still inspecting all
later managed files and retaining their failures.

This fixes the source-only initial setup snapshot without requiring a build.
A clean checkout without dist or generated skills reproduces the one failure
before the change and passes all six setup-environment cases after it. All 41
selected filesystem, cleanup, actual CLI/MCP and environment tests also pass.
The full no-artifact source suite passes 7,446 tests across 508 files with eight
existing platform/condition skips.

Co-authored-by: Kaoru0822 <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Final head is 36b93d512. The review finding is fixed, and the subsequent source-CI failure was an own regression: when an installed file was absent, the new inspection still requested generated canonical bytes. Missing installed files now establish noncanonical state directly, with later read coverage retained.

A clean checkout without dist or generated skills reproduces that exact failure before the fix. After the fix, the same complete source group used by CI passes 508 files / 7,446 tests, with eight existing platform/condition skips. Its production source is byte-identical to the new head. Final focused environment, filesystem, cleanup and actual CLI/MCP consumers pass 41 tests; the preceding full related selection passes 217, full static checks pass, and final check:fast passes. No test assertions or CI gates were weakened.

Final before/after public CLI install/rerun/repair/uninstall tasks return equal results and 10,668 output tokens per four-call task (10,760 explicit transcript proxy). Before cold/warm: 10.70/9.88 s, CPU 11.74/10.58 s, peak family RSS 390/385 MiB. Fixed: 10.30/10.04 s, CPU 11.08/10.93 s, RSS 386/351 MiB. Individual trials with isolated Node compile caches and warm OS caches; no speedup or billed/whole-agent token claim.

New current-head CI/review remains the merge gate. All local heavy verification stayed on two CPUs with the 8-GiB guard; no stop or OOM. Native-platform and concurrent directory-swap limits remain in the PR description.

@N0zoM1z0
N0zoM1z0 merged commit cf6ea09 into morluto:main Oct 14, 2026
36 checks passed
morluto added a commit that referenced this pull request Oct 14, 2026
Render a terminal dry-run plan only after setup admission succeeds. Blocked skill or registration plans use the existing remediation output. Reuse one bounded PTY helper for success and refusal workflows; verify no linked target or client configuration changes.

Follow-up-to: #3108
Validation: public CLI PTY tests and RPC owner controls pass (77 tests); build and static checks pass.
@morluto morluto added bug Something isn't working area: setup Setup, packaging, upgrade, install, Doctor, and client registration labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Setup writes the skill through a symlinked skill directory that uninstall and update skip

3 participants