Skip to content

fix(share): clear error when local mount path is read-only (#3192)#3646

Merged
cv merged 2 commits into
NVIDIA:mainfrom
latenighthackathon:fix/share-mount-rofs-writable-check
May 16, 2026
Merged

fix(share): clear error when local mount path is read-only (#3192)#3646
cv merged 2 commits into
NVIDIA:mainfrom
latenighthackathon:fix/share-mount-rofs-writable-check

Conversation

@latenighthackathon

@latenighthackathon latenighthackathon commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

nemoclaw <name> share mount now fails fast with a structured, actionable error when the local mount path is on a read-only filesystem, instead of leaking the low-level fusermount3: user has no write access to mountpoint line that #3192 reported on AlmaLinux 9.7.

Related Issue

Closes #3192

Changes

  • New checkLocalMountWritable(localMount) helper in src/lib/share-command.ts recursively creates the mount directory and verifies the resulting path is writable, distinguishing EROFS (parent on read-only fs), EACCES (permission denied), and other failures and returning a structured { writable, reason } result.
  • runShareMount consults this helper after writing the temporary SSH config and before invoking sshfs. A non-writable target now exits with the offending path, the underlying reason, and a suggested writable-path invocation; the temporary SSH config file is cleaned up before the early exit so we don't leave an orphan in /tmp. Sample output for a read-only target: Local mount path '/ro/mounts/my-assistant' is not usable: parent filesystem is read-only. share mount projects sandbox files onto a host directory via SSHFS, so the local target must be on a writable filesystem. Pick a writable directory: nemoclaw my-assistant share mount /sandbox <writable-path>.
  • docs/reference/commands.md and the agent-skill mirror in .agents/skills/nemoclaw-user-reference/references/commands.md now include the writable-mount-target requirement in the share mount prerequisites, so users hitting the default ~/.nemoclaw/mounts/<name> on a read-only filesystem know they can pass an explicit local path as the second positional argument.
  • New test/share-command-writable.test.ts covers five cases for the helper: success, EROFS from mkdirSync, EACCES from mkdirSync, an unexpected mkdirSync failure (ENOSPC), and a pre-existing directory whose accessSync fails.

Type of Change

  • Code change with doc updates
  • Code change (feature, bug fix, or refactor)
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes (commitlint, gitleaks, biome, TypeScript, source-shape, skills YAML, dist-sourcemaps)
  • npm test (npx vitest run) passes for the new file: 5/5 in test/share-command-writable.test.ts. Full suite was 3525 passed / 4 pre-existing timing flakes (sandbox-stuck-recovery, cli timing assertion) / 13 skipped; flakes are unrelated to share-command.ts and pass 4/4 in isolation.
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes

Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com

Summary by CodeRabbit

  • Documentation

    • Clarified share mount prerequisites: the local mount destination must be on a writable filesystem; if the default location is read-only, provide an explicit writable path.
  • Bug Fixes

    • Added preflight validation for mount destination writeability with clear, targeted error output and early exit to avoid partial operations.
  • Tests

    • Added tests covering writable, read-only, permission-denied, and other filesystem error scenarios.

Review Change Stack

Closes NVIDIA#3192. `nemoclaw <sandbox> share mount` calls
`fs.mkdirSync(localMount, { recursive: true })` unconditionally before
invoking `sshfs`. When the default `~/.nemoclaw/mounts/<sandbox>` parent
lives on a read-only filesystem (immutable home, restricted VM, etc.) the
call throws `EROFS` from inside the bare mkdir and the user sees a raw
Node stack trace with no actionable guidance.

Add a `checkLocalMountWritable()` helper that probes the target directory
for both `mkdirSync` and `accessSync(W_OK)` failures and returns a
structured `{ writable, reason }` result. `runShareMount` calls it after
the SSH config has been staged and exits with a clear three-line message
("Local mount path is not usable", explanation, and a "Pick a writable
directory" command suggestion) when the target is unwritable, cleaning
up the staged SSH config first.

Docs: add a one-sentence prerequisite to `docs/reference/commands.md`
and the mirrored skill reference pointing users to pass an explicit
writable path as the second positional argument when the default lives
on a read-only filesystem.

Tests: `test/share-command-writable.test.ts` covers the 6 paths:
success, EROFS-on-mkdir, EACCES-on-mkdir, unknown-error-on-mkdir,
EROFS-on-access (pre-existing dir on read-only fs), and EACCES-on-access.
6/6 pass; existing 9/9 share-command.test.ts pass unchanged.

Signed-off-by: latenighthackathon <support@latenighthackathon.com>
Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented May 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: aaa8f348-13fc-4f66-ad5d-379601c1f196

📥 Commits

Reviewing files that changed from the base of the PR and between 40d6594 and 99e45e1.

📒 Files selected for processing (1)
  • docs/reference/commands.md
✅ Files skipped from review due to trivial changes (1)
  • docs/reference/commands.md

📝 Walkthrough

Walkthrough

Adds a preflight check to verify the local mount path is writable before performing SSHFS mounts via nemoclaw share mount. Introduces checkLocalMountWritable(), integrates it into runShareMount to fail early with clear reasons and cleanup, and updates docs and tests to cover success and error cases.

Changes

Writable Mount Validation

Layer / File(s) Summary
Local mount writability check and integration
src/lib/share-command.ts, test/share-command-writable.test.ts
New exported checkLocalMountWritable() creates the mount directory and validates write permissions, mapping EROFS/EACCES and other errors into { writable, reason? }. runShareMount calls this preflight and, on failure, prints the reason, removes temporary SSH config, and exits. Vitest suite verifies success and multiple failure scenarios.
Command documentation updates
docs/reference/commands.md, .agents/skills/nemoclaw-user-reference/references/commands.md
Both command reference files updated to document that the local mount destination must be on a writable filesystem and to advise supplying an explicit writable path when the default ~/.nemoclaw/mounts/<name> is read-only.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • jyaunches

Poem

🐰 I sniff the mount, I hop and pry,
Is it writable? I'll tell you why.
EROFS or EACCES, I'll report the clue,
Make a dir that writes, and sharing's true.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: improving error handling when the local mount path is read-only, with a specific reference to issue #3192.
Linked Issues check ✅ Passed The PR fully addresses issue #3192 by implementing a writable filesystem check, providing clear error messages, and documenting the requirement for writable local mount targets.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving issue #3192: adding the writable check function, integrating it into the command, updating documentation, and adding corresponding tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@cv cv enabled auto-merge (squash) May 16, 2026 21:25
@cv cv merged commit 939cf30 into NVIDIA:main May 16, 2026
23 of 25 checks passed
@latenighthackathon latenighthackathon deleted the fix/share-mount-rofs-writable-check branch May 18, 2026 05:11
ericksoa pushed a commit that referenced this pull request May 18, 2026
## Summary
Updates the NemoClaw documentation for the v0.0.45 release by
summarizing the user-facing changes merged since v0.0.44 and bumping the
docs version metadata.
Refreshes generated user skills so agent-facing references match the
source docs.

## Changes
- Added v0.0.45 release notes covering onboarding recovery, local
inference, channel cleanup, share mount diagnostics, uninstall cleanup,
and security redaction updates.
- Updated command and troubleshooting docs for sandbox name limits, GPU
gateway reuse, DNS preflight behavior, channel removal cleanup, and
share mount path validation.
- Bumped docs version metadata to 0.0.45 and regenerated NemoClaw user
skills from the docs.
- Source summary: #3672 -> `docs/reference/commands.md`: documented
channel removal detaching bridge providers and un-applying channel
policy presets.
- Source summary: #3678 -> `docs/about/release-notes.md`: documented
Ollama streamed usage accounting in the release notes.
- Source summary: #3670 -> `docs/reference/commands.md`,
`docs/reference/troubleshooting.md`: documented safe GPU gateway
replacement behavior.
- Source summary: #3664 -> `docs/about/release-notes.md`: documented
blueprint permission normalization in the release notes.
- Source summary: #3181 -> `docs/reference/troubleshooting.md`:
documented GPU toolkit guidance when host drivers work but passthrough
is disabled.
- Source summary: #3554 -> `docs/about/release-notes.md`: documented
host `openshell-gateway` cleanup during uninstall.
- Source summary: #3651 -> `docs/reference/troubleshooting.md`:
documented the uncached `.invalid` DNS preflight probe.
- Source summary: #3643 -> `docs/reference/commands.md`: included
existing `NEMOCLAW_PROVIDER` interactive-mode behavior in generated
docs.
- Source summary: #3647 -> `docs/reference/commands.md`: documented
remote sandbox path verification for `share mount`.
- Source summary: #3646 -> `docs/reference/commands.md`: included
existing local writable mount target guidance in generated docs.
- Source summary: #3642 -> `docs/inference/use-local-inference.md`,
`docs/reference/commands.md`: documented managed-vLLM model override and
gated-model token checks.
- Source summary: #3639 -> `docs/reference/commands.md`: documented the
63-character sandbox name limit.

## Type of Change
- [ ] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [x] Doc only (includes code sample changes)

## Verification
- [ ] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [x] Docs updated for user-facing behavior changes
- [x] `make docs` builds without warnings (doc changes only)
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

Commit hooks passed for the staged files. A standalone `npx prek run
--all-files` attempt was blocked by sandbox access to
`/Users/miyoungc/.cache/prek/prek.log`, so that checkbox is left
unchecked.

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Miyoung Choi <miyoungc@nvidia.com>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Enhanced CLI command reference documentation with clearer guidance on
onboarding, GPU passthrough, inference configuration, channel removal,
and shared mounts.
* Improved troubleshooting sections with better DNS resolution and GPU
passthrough remediation steps.
  * Added documentation for overriding managed vLLM model selection.
* Updated release notes for v0.0.45 reflecting infrastructure and
workflow improvements.

* **Version Bump**
  * Released v0.0.45.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3755?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nemoclaw sandbox_name share mount error when mounting into read-only filesystem

3 participants