fix: quote sandbox name in openshell policy commands#49
Merged
Conversation
The sandbox name was interpolated unquoted into shell commands passed to openshell policy set/get. This caused argument parsing failures when the sandbox name or prior shell state introduced unexpected tokens (e.g. 'mkdir' from DGX Spark sudo context). Extracts buildPolicySetCommand/buildPolicyGetCommand helpers that properly quote all arguments, and adds tests to verify. Fixes #46 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Contributor
|
Nice fix. One pre-existing bug worth fixing here while we're touching this file: currentPolicy is declared const on line 94 but reassigned on line 136: const currentPolicy = parseCurrentPolicy(rawPolicy);
// ...
if (!currentPolicy.includes("version:")) {
currentPolicy = "version: 1\n" + currentPolicy; // TypeError: Assignment to constant variable
} This will throw at runtime if a sandbox has an existing policy with no |
dnandakumar-nv
approved these changes
Mar 17, 2026
Resolve merge conflict in bin/lib/policies.js — keep the extracted buildPolicyGetCommand/buildPolicySetCommand helpers (PR's approach) over main's inline quoting, since the helpers are tested and exported.
ericksoa
added a commit
that referenced
this pull request
Mar 17, 2026
currentPolicy was declared const but reassigned when prepending a version field to policies missing one. This throws TypeError at runtime for sandboxes with existing policies that lack a version field. Spotted by @dnandakumar-nv in #49.
1 task
dnandakumar-nv
pushed a commit
that referenced
this pull request
Mar 17, 2026
…or (#232) currentPolicy was declared const but reassigned when prepending a version field to policies missing one. This throws TypeError at runtime for sandboxes with existing policies that lack a version field. Spotted by @dnandakumar-nv in #49.
Ryuketsukami
pushed a commit
to Ryuketsukami/NemoClaw
that referenced
this pull request
Mar 24, 2026
The sandbox name was interpolated unquoted into shell commands passed to openshell policy set/get. This caused argument parsing failures when the sandbox name or prior shell state introduced unexpected tokens (e.g. 'mkdir' from DGX Spark sudo context). Extracts buildPolicySetCommand/buildPolicyGetCommand helpers that properly quote all arguments, and adds tests to verify. Fixes NVIDIA#46 Signed-off-by: Aaron Erickson <aerickson@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ryuketsukami
pushed a commit
to Ryuketsukami/NemoClaw
that referenced
this pull request
Mar 24, 2026
…or (NVIDIA#232) currentPolicy was declared const but reassigned when prepending a version field to policies missing one. This throws TypeError at runtime for sandboxes with existing policies that lack a version field. Spotted by @dnandakumar-nv in NVIDIA#49.
jessesanford
pushed a commit
to jessesanford/NemoClaw
that referenced
this pull request
Mar 24, 2026
The sandbox name was interpolated unquoted into shell commands passed to openshell policy set/get. This caused argument parsing failures when the sandbox name or prior shell state introduced unexpected tokens (e.g. 'mkdir' from DGX Spark sudo context). Extracts buildPolicySetCommand/buildPolicyGetCommand helpers that properly quote all arguments, and adds tests to verify. Fixes NVIDIA#46 Signed-off-by: Aaron Erickson <aerickson@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jessesanford
pushed a commit
to jessesanford/NemoClaw
that referenced
this pull request
Mar 24, 2026
…or (NVIDIA#232) currentPolicy was declared const but reassigned when prepending a version field to policies missing one. This throws TypeError at runtime for sandboxes with existing policies that lack a version field. Spotted by @dnandakumar-nv in NVIDIA#49.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #46 — onboarding fails at step [7/7] with
unexpected argument 'mkdir'when applying policy presets.The sandbox name was interpolated unquoted into shell commands:
On DGX Spark, prior
sudousage pollutes openshell's shell context, causing stray tokens likemkdirto leak into the argument list.Changes
buildPolicySetCommand()andbuildPolicyGetCommand()helpers that properly quote all argumentsTest plan
npm test— all 42 tests passnemoclaw <name> policy-addworks with preset application🤖 Generated with Claude Code