Skip to content

fix(skills): install from the literal selected local source - #199637

Closed
Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-local-skill-source-paths-20261115
Closed

Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-local-skill-source-paths-20261115

Conversation

@Alix-007

@Alix-007 Alix-007 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

skills install "<local-directory> " can report success after installing a different valid neighbouring skill: the local source path is trimmed and lexically resolved before native traversal. A directory alias followed by .. can select another source in the same way. The resulting instructions and companion files differ from the operator's selection.

User Impact

Local skill installation validates, scans and copies the source the supplied path actually names. Quoted significant spaces and directory-symlink traversal are retained. Unreachable input does not fall back to a neighbouring skill. Ordinary paths, Git source parsing, slug validation, install policy, staging, no-force protection and discovery refresh retain their existing owners.

Why This Change Was Made

Resolve the raw local source once through native realpath, after existing home-prefix expansion and before directory validation, security policy and copying. The Git branch continues using its normalized spec. Retain the original local source in the existing origin metadata so the receipt reflects what was requested; the installed destination remains the canonical workspace slug directory.

This is the complete source-selection owner for the local installer. The library-upload command is a separate Gateway operation. No new options, dependency, permission, config/default, schema, protocol, migration or linked-plugin identity changes. No modified release-owned CHANGELOG or proof assets in the product branch.

Evidence

Product head: 13609e43e2bb2f89a249a3767f6f30eaff050e7d; BASE: c0166c395cf81095f431808c9496cb6022ad4387.
Paired CLI output, installed content/origin readback, frozen collector and independent review.

Same actual local install BASE HEAD
Quoted source directory ending in a space Exit0; installed instructions/asset are from valid trimmed neighbour Exit0; intended literal instructions/asset installed
Directory alias + parent traversal Exit0; installed instructions/asset are from valid lexical neighbour Exit0; intended physical instructions/asset installed
Ordinary local source Intended instructions and asset Same intended instructions and asset
  • Production entry + exact command: python3 skill-source-proof-v1.py CHECKOUT FRESH_OUTPUT NODE26 MODE with red on BASE and green on HEAD; frozen collector SHA256 dd30dee3aa61f2f66bb4d87db7fa6c53c78f56fa225d0a6c197a1c9630475c7b matches both. It executes normally built openclaw.mjs skills install <path> --agent main --as <slug>. Clean exact-head normal cliStartup build exits0 in315.641s.
  • Canonical owner / boundary: actual installSkillFromSource -> existing skill loader, install policy and extracted-root installer -> independently opened installed SKILL.md, supporting file and .openclaw/source-origin.json. No copy, filesystem, policy or install owner is replaced by a test double. All three real commands exit0 on both revisions; BASE's two selected installations demonstrably contain decoy source bytes. HEAD's three readbacks match the intended sources.
  • Default-name compatibility repair: Physical source selection and the displayed/default install name have separate owners. The original selected path supplies the fallback label; realpath supplies validation, scan and copy. Explicit --as, valid frontmatter names and existing slug validation retain precedence. python3 skill-source-alias-proof-v1.py CHECKOUT FRESH_OUTPUT NODE26 MODE (frozen SHA256 e200b345672fc7a8bf5f1a018a281c08e7abed31e05233795e89b0782fd43f3f) separately compares first-published head 053bbca1b99ed32cda882362ce00fa82c3465e44 with this repair. Without --as, an alias my-guide to release.1 previously rejected a legal alias and an alias to different-name installed under the wrong name; the repaired commands both install my-guide. The ordinary no-override control also succeeds. Three actual CLI commands use installed instruction/asset/origin readback; source bytes remain unchanged. This repair baseline is distinct from original current-main BASE above.
  • Controls: ordinary installation succeeds with the same expected bytes. All 10 source-file hashes remain unchanged. Final metadata identifies the requested source and installed slug. Focused tests include missing/.. input refusal with no installation, physical/trimmed decoys and unchanged source files; the existing suite retains Git behavior, invalid-source diagnostics, hardlinks, metadata, no-force and policy controls. Wrong installed-source count changes2 to0 while successful ordinary installation remains1.
  • Focused tests: pnpm test src/skills/lifecycle/source-install.test.ts src/skills/lifecycle/source-install-paths.test.ts --maxWorkers=1:31 PASS in250.104s wall, including compiler-worker preparation and existing installer/Git fixtures. Final semantic types, typed lint, format and staged test/file line ratchets pass. The original426-line suite stays unchanged; the new focused file is bounded and serves the independent source-selection defect. Independent full source review passes through the authorized GPT6.1Sol fallback, with final exact-head evidence/body assessment linked above; official autoreview execution is not claimed.
  • Existing-solutions/sibling preflight: full exact symbol/title/path and open-account footprint scans found no viable local-source-selection competitor. Native filesystem traversal and existing installer absorb the repair. Git transport, ClawHub, dependency installation, remote workspace lifecycle and plugin install-record parsing are unchanged; no withdrawn proposal is claimed as an accepted merge precedent.
  • Cleanup: isolated Ubuntu24.04/Node26.12.1 container with network disabled, private HOME/config/state/workspace and synthetic local skill files. Installed fixtures are retained for inspection outside the product branch. No real provider, channel, registry account or production configuration is used.
  • Not tested: external Git/ClawHub availability, production skill activation, native macOS/Windows, hosted CI or full repository suite. This proves local selection and actual installed files, without claiming a live remote service or broader linked-plugin cutover.
Production / test LOC
86	0	src/skills/lifecycle/source-install-paths.test.ts
7	5	src/skills/lifecycle/source-install.ts

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Local skill installation preserves literal source paths and native symlink traversal while retaining the selected alias as the fallback install name.

Example: Run openclaw skills install "/tmp/source " --as installed-guide when both /tmp/source and /tmp/source contain valid skills.

  • Before: The command succeeds but installs instructions and companion files from /tmp/source.
  • After: The command installs the selected files from /tmp/source and records the literal requested path.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, source-verified repair with inspected before/after CLI evidence and the previous finding resolved; hosted CI awaits workflow approval.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Inspected Ubuntu/Node CLI artifacts at the exact product head exercise the production installer and independently read installed instructions, assets, and origin metadata for literal-space paths, symlink-parent traversal, default aliases, and ordinary controls; the unchanged Gateway-refresh warning does not invalidate local-copy proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A successful local skill installation can contain instructions and companion files from a directory the operator did not select.
Reason: Literal source selection restores the documented local-copy behavior while preserving existing naming, validation, and install-policy owners.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR fixes a concrete wrong-source installation bug still present on current main. The prior alias-name finding is resolved, and no remaining introduced defect was found.

Priority: P2
Reviewed head: 13609e43e2bb2f89a249a3767f6f30eaff050e7d

Before merge

  • Await maintainer action - Approve the GitHub Actions runs awaiting approval for head 13609e4.

Findings

None.

Agent review details

How this fits together

The skills CLI passes a local source to the installer, which validates its content, applies install policy, copies it into the workspace, and records source metadata.

flowchart LR
  A[Skills install CLI] --> B[Literal path and home expansion]
  B --> C[Native filesystem resolution]
  C --> D[Existing skill validation]
  D --> E[Existing install policy and copy]
  E --> F[Workspace skill and source receipt]
Loading

Technical review

Best possible solution:

Use native traversal for the selected copy source and retain the selected path for fallback naming, as this PR now does.

Do we have a high-confidence way to reproduce the issue?

Inspected paired CLI artifacts reproduce both wrong-source cases on the pinned base, whose installer matches current main; no target code was executed during this review.

Is this the best way to solve the issue?

The change fixes selection at the existing installer boundary without adding another owner, and its distinct filesystem regressions protect literal paths, physical traversal, alias naming, and missing-component rejection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5dbf569b4b85.

Provenance checked

  • Local source selection and fallback naming changes intended behavior with a stated reason (c031274: The original feature added local-directory installation with frontmatter-derived slugs and explicit overrides; subsequent refactors retained its normalization.)
  • Canonical validation and installer failure handling keeps the original intent (594e6b0: The merged refactor reused the bounded loader, preserved source-label fallback, and routed failures to the existing CLI error boundary.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main retains the defect: The current-main installer trims the input and calls resolveUserPath before filesystem access; comparison with the reproduction base shows this module is unchanged. (src/skills/lifecycle/source-install.ts:235, 5dbf569b4b85)
  • Pinned introduced change: The introduced diff resolves the untrimmed local input physically, passes that source to the existing installer, preserves the raw source receipt, and derives the fallback label from the selected path. (src/skills/lifecycle/source-install.ts:239, 13609e43e2bb)
  • Prior finding repaired: The follow-up changes fallbackLabel to use sourcePath and adds regressions for aliases targeting both an invalid physical basename and a different valid basename. (src/skills/lifecycle/source-install.ts:256, 13609e43e2bb)
  • Inspected shipped CLI proof: The pinned evidence includes BASE.json and HEAD.json showing wrong decoy bytes before the fix and intended instruction, asset, and origin readbacks afterward; HEAD-alias.json separately verifies both default-alias repairs and an ordinary control through the built CLI. (HEAD.json, 6f096e384294)
  • Feature provenance: The original local/Git installation implementation introduced source normalization and basename fallback; its merged PR describes local-directory copying, frontmatter slug inference, and explicit overrides: feat: support git and local skill installs #84793. (src/agents/skills-source-install.ts, c0312748c4f7)
  • Existing metadata remains compatible: The source-origin writer retains its existing version and fields; discovery reads the stored slug rather than interpreting spec, so preserving literal spec bytes requires no migration of existing receipts. (src/skills/loading/skill-entry-metadata.ts:33, 13609e43e2bb)

Likely related people:

  • Peter Steinberger: Raw commit e79d004 adds src/skills/lifecycle/source-install.ts:94 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e79d0044c2a6; files: src/skills/lifecycle/source-install.ts)
  • Patrick Erichsen: Raw commit c031274 adds src/agents/skills-source-install.ts:387 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c0312748c4f7; files: src/agents/skills-source-install.ts)
  • Kimi Yu: Raw commit e63393b adds src/skills/lifecycle/source-install.ts:116 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: e63393bddc3a; files: src/skills/lifecycle/source-install.ts)

PR surface

Source +2, Tests +86. Total +88 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 7 5 +2
Tests 1 86 0 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 93 5 +88

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: Specific local path forms silently install a different valid skill; ordinary installations are unaffected.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-15T14:59:29.298Z sha 053bbca :: needs changes before merge. :: [P2] Preserve the selected alias when inferring the fallback slug

Reviewed November 15, 2026, 10:52 AM ET / 15:52 UTC (Revision 2).

@Alix-007

Copy link
Copy Markdown
Contributor Author

Preserved the selected directory alias as the fallback skill name while keeping physical paths for validation and copying. All31 focused tests pass. The rebuilt CLI at 13609e43e2bb2f89a249a3767f6f30eaff050e7d passes the original3 source-selection cases and both default-alias regressions plus the ordinary control, with installed file and origin readbacks. Updated exact-head evidence is linked in the body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus

obviyus commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the work here. We're closing this along with the other open PRs that apply the same change one call site at a time. This series changes symlink, physical-path and literal-path handling at each command separately; path resolution policy belongs in one shared owner and needs a maintainer decision. Please open one issue (or one PR at the shared owner) that covers the whole pattern, with a reproduction of real user-visible harm, instead of separate per-site PRs. Further per-site variants of this pattern will be closed.

@obviyus obviyus closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants