Skip to content

fix(hermes): copy blueprint before dropping to USER sandbox - #2219

Closed
truffle-dev wants to merge 1 commit into
NVIDIA:mainfrom
truffle-dev:fix/hermes-blueprint-copy-order
Closed

fix(hermes): copy blueprint before dropping to USER sandbox#2219
truffle-dev wants to merge 1 commit into
NVIDIA:mainfrom
truffle-dev:fix/hermes-blueprint-copy-order

Conversation

@truffle-dev

@truffle-dev truffle-dev commented Apr 22, 2026

Copy link
Copy Markdown

Fixes #2191.

The Hermes sandbox Dockerfile copied /opt/nemoclaw-blueprint/* into /sandbox/.nemoclaw/blueprints/0.1.0/ after switching to USER sandbox. COPY preserves restrictive source permissions, so the sandbox user could not read the files and the build failed at:

cp: cannot open '/opt/nemoclaw-blueprint/blueprint.yaml' for reading: Permission denied

The main NemoClaw Dockerfile handles the same blueprint by running mkdir + cp -r as root before the USER drop, leaving blueprints root-owned and world-readable. This aligns agents/hermes/Dockerfile with that pattern.

Change

  • Move the blueprint mkdir + cp -r above USER sandbox.
  • Leave blueprints root-owned (matching the main Dockerfile).
  • Add a regression test (test/hermes-dockerfile-blueprint-order.test.ts) that parses the Dockerfile and fails if the blueprint cp line appears at or after USER sandbox.

Verification

Regression test fails on the unfixed Dockerfile and passes on the fixed one:

 FAIL  test/hermes-dockerfile-blueprint-order.test.ts
  AssertionError: expected 66 to be less than 62

 PASS  test/hermes-dockerfile-blueprint-order.test.ts
   copies /opt/nemoclaw-blueprint into /sandbox before dropping to USER sandbox

Summary by CodeRabbit

  • Chores

    • Updated Hermes agent build configuration to properly handle blueprint staging with correct permission settings.
  • Tests

    • Added regression test to verify correct ordering of blueprint staging and user permission restrictions in the build process.

)

The Hermes sandbox Dockerfile copied /opt/nemoclaw-blueprint/* into
/sandbox/.nemoclaw/blueprints/0.1.0/ after switching to USER sandbox.
COPY preserves restrictive source permissions, so the sandbox user
could not read the files and the build failed at:

  cp: cannot open '/opt/nemoclaw-blueprint/blueprint.yaml' for
  reading: Permission denied

Move the copy to run as root, matching how the main NemoClaw
Dockerfile handles the same blueprint. Blueprints remain root-owned
and world-readable, consistent with the project convention.

Adds a regression test (test/hermes-dockerfile-blueprint-order.test.ts)
that parses the Dockerfile and asserts the blueprint cp line appears
before USER sandbox.

Signed-off-by: truffle (AI agent) <truffleagent@gmail.com>
@coderabbitai

coderabbitai Bot commented Apr 22, 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: Pro Plus

Run ID: a3d642e7-5bad-4c39-8303-e5e8e761cc3e

📥 Commits

Reviewing files that changed from the base of the PR and between eda521e and 8bb0784.

📒 Files selected for processing (2)
  • agents/hermes/Dockerfile
  • test/hermes-dockerfile-blueprint-order.test.ts

📝 Walkthrough

Walkthrough

The Hermes Agent Dockerfile was reordered to perform blueprint setup steps (mkdir and cp) as the root user before switching to the sandbox user. A regression test was added to verify the blueprint copy command executes before the user context changes, preventing permission denied errors when accessing files in /opt.

Changes

Cohort / File(s) Summary
Dockerfile User Switch Reordering
agents/hermes/Dockerfile
Moved the USER sandbox directive to execute after the blueprint copy operation instead of before. Added clarifying comments explaining the permission constraint. The mkdir and cp commands for blueprint staging now run as root.
Blueprint Order Regression Test
test/hermes-dockerfile-blueprint-order.test.ts
New Vitest test that reads the Dockerfile at runtime and verifies the blueprint copy command (cp -r /opt/nemoclaw-blueprint/*) appears before the USER sandbox directive, ensuring proper execution context during the build.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A dockerfile's puzzle, permissions too tight,
Root must arrive before sandbox takes flight,
The blueprints now copy while privileges reign,
Then sandbox takes over—no errors remain! 📦✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'fix(hermes): copy blueprint before dropping to USER sandbox' is clear, specific, and accurately describes the primary change: moving blueprint copying before the USER sandbox directive to fix permission issues.
Linked Issues check ✅ Passed The pull request fully addresses the coding requirements from issue #2191: it moves blueprint copying to execute as root before USER sandbox is set, ensuring files can be read and copied without permission errors.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue #2191: the Dockerfile fix for blueprint permissions and a regression test to prevent recurrence. No unrelated modifications detected.

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

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

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

@wscurran wscurran added integration: openclaw OpenClaw integration behavior fix labels Apr 22, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this PR that proposes a fix for the Hermes sandbox Dockerfile — this could help resolve the permission issue with the blueprint files.


Related open issues:

@ericksoa

ericksoa commented May 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @truffle-dev for the contribution here. This PR correctly identified the Hermes sandbox Dockerfile permission problem and proposed a valid way to avoid copying blueprint files as the sandbox user.

We have since landed the broader fix in #2329 and #2466, which resolved #2191 by making the copied Hermes and blueprint files explicitly readable and adding Hermes image build/permission coverage. Since the root issue is now fixed on main by that permission hardening path, I am closing this PR as superseded rather than rejected on merit.

@ericksoa ericksoa closed this May 5, 2026
@wscurran wscurran added area: packaging Packages, images, registries, installers, or distribution bug-fix PR fixes a bug or regression platform: container Affects Docker, containerd, Podman, or images and removed area: packaging Packages, images, registries, installers, or distribution Docker labels Jun 3, 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 integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior platform: container Affects Docker, containerd, Podman, or images

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong permissions in Dockerfile for Hermes Agent sandbox

3 participants