Skip to content

fix(skills): add-rtk mount rejected on v2 — relative containerPath + PATH#2969

Open
OowhitecatoO wants to merge 1 commit into
nanocoai:mainfrom
OowhitecatoO:fix/add-rtk-v2-mount
Open

fix(skills): add-rtk mount rejected on v2 — relative containerPath + PATH#2969
OowhitecatoO wants to merge 1 commit into
nanocoai:mainfrom
OowhitecatoO:fix/add-rtk-v2-mount

Conversation

@OowhitecatoO

Copy link
Copy Markdown

Type of Change

  • Operational/container skill - adds a workflow or agent skill (SKILL.md only, no source changes)

This is a fix to an existing operational skill (/add-rtk), entirely within its SKILL.md / REMOVE.md — no source changes.

Description

The /add-rtk skill mounts rtk at an absolute containerPath (/usr/local/bin/rtk). On NanoClaw v2, mount-security (src/modules/mount-security/index.ts) rejects any absolute container path — additional mounts must be relative and are force-prefixed under /workspace/extra/. So the mount is silently rejected (Additional mount REJECTED in logs/nanoclaw.error.log), rtk never reaches the container, and the PreToolUse hook that rewrites Bash commands to the bare name rtk … fails quietly. The skill has never worked on v2.

What changed (SKILL.md + REMOVE.md only):

  • Mount at relative bin/rtk → lands at /workspace/extra/bin/rtk (read-only).
  • New step: add the rtk path to the mount allowlist (~/.config/nanoclaw/mount-allowlist.json), with a host-service restart note (the allowlist is cached in-process).
  • New step: put /workspace/extra/bin on PATH via the group's settings.json env (Claude Code applies env to Bash subprocesses and treats values literally, so the full container PATH is set), and invoke the hook by absolute path so the hook itself never depends on PATH. Only the bare rtk … the hook emits relies on the injected PATH.
  • Dedup matches both the new bin/rtk and the legacy /usr/local/bin/rtk, so re-running heals installs from the broken skill. Added a "Migrating from an earlier version" callout.
  • Troubleshooting now points at the real failure signal (Additional mount REJECTED) and the two independent gates (mount-security path rule + allowlist).
  • Added an "Updating rtk later" note: a running container binds the binary by inode, so an atomic-replace update needs a container restart to take effect.

Refs #1792 (documents the undocumented relative-path / /workspace/extra/ prefix behavior), #2571 (introduced the broken skill).

For Skills

  • SKILL.md contains instructions, not inline code (code goes in separate files)
  • SKILL.md is under 500 lines (193)
  • I tested this skill on a fresh clone

Testing note (honest): validated on a live v2 install across six agent groups rather than a fresh clone — the relative mount lands read-only at /workspace/extra/bin/rtk and rtk --version runs inside the container; with the injected env.PATH the bare rtk resolves while git / node still resolve; logs/nanoclaw.error.log shows no new Additional mount REJECTED after the fix; and the jq filters in Step 5 / REMOVE were verified idempotent (re-run leaves a single hook, sets/removes PATH cleanly, and preserves other env keys and the PreCompact hook).

🤖 Generated with Claude Code

…PATH

The add-rtk skill mounted rtk at an absolute containerPath
(/usr/local/bin/rtk), which mount-security rejects on v2 (containerPath
must be relative and is force-prefixed under /workspace/extra/). rtk never
reached the container and the PreToolUse hook failed silently.

- Mount at relative bin/rtk (lands at /workspace/extra/bin/rtk, read-only)
- Add the rtk path to the mount allowlist (new step)
- Put /workspace/extra/bin on PATH via settings.json env and invoke the
  hook by absolute path, so the bare `rtk` the hook emits resolves
- Dedup matches both old and new containerPath, so re-running heals
  installs from the broken skill; add a migration callout
- Troubleshooting now points at the real signal (Additional mount REJECTED)

Refs nanocoai#1792, nanocoai#2571

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added follows-guidelines PR was created using the current contributing template PR: Skill Skill package or skill-related changes labels Jul 7, 2026
OowhitecatoO added a commit to OowhitecatoO/nanoclaw that referenced this pull request Jul 8, 2026
舊 add-rtk 把 rtk 掛在絕對 containerPath /usr/local/bin/rtk,v2 的
mount-security 只允許相對路徑(強制前綴 /workspace/extra/),整個 mount
被靜默拒絕(error.log 的 Additional mount REJECTED),rtk 從沒進過容器、
PreToolUse hook 靜默失敗。本 commit 把 skill 改成 v2 相容做法,零 core 改動。

- 相對 mount bin/rtk → 落點 /workspace/extra/bin/rtk(唯讀)
- 新增 allowlist step(~/.config/nanoclaw/mount-allowlist.json)+ 重啟提醒
- 新增 PATH step:settings.json env 注入 /workspace/extra/bin,hook 改絕對
  路徑(只讓 rtk 改寫出的裸名指令靠注入 PATH 解析);dedup 同時吃舊絕對與
  新相對條目,重跑可自癒
- 遷移段落 +「更新 rtk 後需重啟容器(mount 綁 inode)」提醒
- Troubleshooting 指向真正訊號 Additional mount REJECTED 與兩道關卡

本地六個 group 已直接修好並實機驗證(mount 唯讀、容器內可執行、注入 PATH
後裸名解析、error.log 無新 REJECTED、jq 冪等)。此修正同步提交上游 PR
nanocoai#2969 —— 將來 rebase / update-nanoclaw 時,若該 PR 已被
merge,可直接丟棄此 commit。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZdXHiD5PoWdDKT1YMCnUF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follows-guidelines PR was created using the current contributing template PR: Skill Skill package or skill-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant