Skip to content

feat(policy): add sandbox policy get command for clean YAML output - #6122

Merged
apurvvkumaria merged 8 commits into
NVIDIA:mainfrom
kagura-agent:fix/policy-get-clean-yaml
Jul 8, 2026
Merged

feat(policy): add sandbox policy get command for clean YAML output#6122
apurvvkumaria merged 8 commits into
NVIDIA:mainfrom
kagura-agent:fix/policy-get-clean-yaml

Conversation

@kagura-agent

@kagura-agent kagura-agent commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds nemoclaw <name> policy-get, a public command that exports the sandbox's round-trippable OpenShell base policy as validated YAML.
The default output strips the OpenShell metadata header and is suitable for review, editing, and openshell policy set; --raw preserves the unparsed metadata-bearing response for diagnostics only.

Related Issue

Closes #6052.

Changes

  • Add the sandbox:policy:get oclif command and the public <name> policy-get route.
  • Read openshell policy get --base, not the effective --full policy, so provider-composed reserved entries are never advertised as round-trippable.
  • Fail closed on empty, malformed, or unsuccessful policy reads while preserving an explicit diagnostic-only --raw mode.
  • Add composed fake-OpenShell coverage for exact argv, metadata stripping, YAML parsing, malformed output, and subprocess failure.
  • Replace the repeated shell/awk metadata workaround in the policy documentation and regenerate the NemoHermes command reference.

Type of Change

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

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — read-only argv execution, fail-closed parsing, and the --base mutation boundary were reviewed and covered by the repository policy-read audit.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, and npx prek run --from-ref origin/main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only) — not run; the change is covered by focused CLI, integration, and package-contract tests.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only) — the build passes with 0 errors and 2 pre-existing hidden warnings.
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only) — not applicable; no new pages were added.

Attribution

Original implementation and PR authorship are by @kagura-agent.
Kagura's two original GitHub-Verified commits, including the original Claude Opus 4 co-authorship trailer, are preserved unchanged.

Signed-off-by: Apurv Kumaria akumaria@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added a new policy-get command to export a sandbox’s base network policy, with an option to print the raw output.
  • Documentation

    • Updated CLI and network policy guides to use the new export-and-reapply workflow.
    • Clarified when to use raw output and when validation failures cause the command to exit.
  • Tests

    • Added coverage for policy export behavior, raw output handling, error cases, and command translation compatibility.

…VIDIA#6052)

The openshell policy get --full output includes a metadata header that
cannot be piped directly to policy set. This adds a CLI command that
strips the header via parseCurrentPolicy and outputs only usable YAML.
A --raw flag preserves the original openshell output when needed.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 1, 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 Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new getSandboxPolicy action and sandbox:policy:get oclif command that exports a sandbox's round-trippable base network policy (raw or parsed YAML), wires CLI route translation, extends the mutation-read audit allowlist, and updates network-policy documentation and command references accordingly.

Changes

Sandbox Policy Get Flow

Layer / File(s) Summary
Policy export action
src/lib/actions/sandbox/policy-get.ts
Adds PolicyGetResult interface and getSandboxPolicy(sandboxName) which captures raw OpenShell base-policy output and parses it into YAML when present.
Command surface, execution, and CLI route wiring
src/commands/sandbox/policy/get.ts, test/package-contract/cli/public-argv-translation.test.ts
Adds SandboxPolicyGetCommand with --raw flag and error handling for missing raw/parsed output, and updates argv translation tests/route overrides to map legacy policy-get to sandbox:policy:get.
Command and action tests
src/commands/sandbox/policy/get.test.ts, src/lib/actions/sandbox/policy-get.test.ts
Adds Vitest suites covering success, --raw, empty-result, parse-failure, and thrown-error scenarios for both the command and the underlying action.
Docs and audit updates
docs/network-policy/customize-network-policy.mdx, docs/network-policy/integration-policy-examples.mdx, docs/reference/cli-selection-guide.mdx, docs/reference/commands.mdx, docs/reference/network-policies.mdx, scripts/checks/openshell-policy-mutation-read.ts
Replaces prior openshell policy get --base shell-pipeline instructions with the new $$nemoclaw <name> policy-get export workflow across docs, documents the new command and --raw flag, updates policy-add behavior description, and extends the mutation-read audit allowlist for the new action.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SandboxPolicyGetCommand
  participant getSandboxPolicy
  participant runCapture
  participant parseCurrentPolicy

  User->>SandboxPolicyGetCommand: sandbox:policy:get <name> [--raw]
  SandboxPolicyGetCommand->>getSandboxPolicy: getSandboxPolicy(name)
  getSandboxPolicy->>runCapture: openshell policy get --base <name>
  runCapture-->>getSandboxPolicy: raw output
  alt raw non-empty
    getSandboxPolicy->>parseCurrentPolicy: parse(raw)
    parseCurrentPolicy-->>getSandboxPolicy: yaml
  end
  getSandboxPolicy-->>SandboxPolicyGetCommand: { raw, yaml }
  alt --raw flag set
    SandboxPolicyGetCommand->>User: log raw
  else no raw
    SandboxPolicyGetCommand->>User: log yaml
  end
Loading

Related issues: #6052

Suggested labels: documentation, enhancement, cli

Suggested reviewers: (none identified from provided context)

Poem

A rabbit taps the sandbox gate,
exports the base, both raw and straight,
strips the header, keeps it clean,
yaml hops from the machine,
--raw warns "don't reapply this state!"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a sandbox policy get command that emits clean YAML.
Linked Issues check ✅ Passed The new policy-get command strips metadata by default and keeps --raw for diagnostics, which addresses the round-trip parse failure in #6052.
Out of Scope Changes check ✅ Passed The docs, tests, and audit allowlist changes all support the new policy export command and its round-trip behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/commands/sandbox/policy/get.test.ts (1)

29-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Tests assert mock calls instead of observable output.

Both the default-parsing test and the --raw test verify only that internal helpers were invoked with certain args, never that the command actually logs the expected YAML/raw content. This locks tests to implementation details rather than the command's public behavior (what a user sees on stdout), and would mask a behavioral regression while still passing.

As per path instructions, tests should "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."

✅ Suggested addition: assert on logged output
+  it("invokes openshell and parses policy by default", async () => {
     const rawOutput =
       "Version: 1\nHash: abc\nStatus: active\n---\nversion: 1\nnetwork_policies: []";
     mocks.runCapture.mockReturnValue(rawOutput);
     mocks.parseCurrentPolicy.mockReturnValue("version: 1\nnetwork_policies: []");

+    const logSpy = vi.spyOn(SandboxPolicyGetCommand.prototype, "log");
     await SandboxPolicyGetCommand.run(["alpha"], rootDir);

     expect(mocks.assertOpenshellResolvable).toHaveBeenCalled();
     expect(mocks.buildPolicyGetCommand).toHaveBeenCalledWith("alpha");
     expect(mocks.runCapture).toHaveBeenCalledWith([...]);
     expect(mocks.parseCurrentPolicy).toHaveBeenCalledWith(rawOutput);
+    expect(logSpy).toHaveBeenCalledWith("version: 1\nnetwork_policies: []");
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/sandbox/policy/get.test.ts` around lines 29 - 58, The
SandboxPolicyGetCommand tests are only checking internal helper calls instead of
the command’s observable output. Update the tests around
SandboxPolicyGetCommand.run to assert the stdout/logged result for both the
default parsed YAML path and the --raw path, using the mocked runCapture output
as the public boundary. Keep the helper setup assertions only if needed for
setup, but make the primary expectation the actual emitted content so the tests
validate user-visible behavior rather than implementation details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/sandbox/policy/get.ts`:
- Around line 36-58: Move the orchestration out of SandboxPolicyGetCommand.run()
and into a sandbox action under src/lib/actions/sandbox, since run() is
currently doing precondition checks, executing OpenShell, and handling parse
branches. Extract the policy retrieval and parsing flow
(assertOpenshellResolvable, buildPolicyGetCommand, runCapture,
parseCurrentPolicy) into a typed action such as getSandboxPolicy, then keep the
command as thin argv/flag parsing plus translating the action result into
this.log/this.error. Preserve the raw/raw-flag and YAML parsing behavior in the
action’s returned result so the command no longer owns product logic.

---

Nitpick comments:
In `@src/commands/sandbox/policy/get.test.ts`:
- Around line 29-58: The SandboxPolicyGetCommand tests are only checking
internal helper calls instead of the command’s observable output. Update the
tests around SandboxPolicyGetCommand.run to assert the stdout/logged result for
both the default parsed YAML path and the --raw path, using the mocked
runCapture output as the public boundary. Keep the helper setup assertions only
if needed for setup, but make the primary expectation the actual emitted content
so the tests validate user-visible behavior rather than implementation details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ece117d6-bea0-4744-adfe-63a0598ad246

📥 Commits

Reviewing files that changed from the base of the PR and between 9df364c and 6956c71.

📒 Files selected for processing (2)
  • src/commands/sandbox/policy/get.test.ts
  • src/commands/sandbox/policy/get.ts

Comment thread src/commands/sandbox/policy/get.ts
Address CodeRabbit review:
- Extract orchestration into src/lib/actions/sandbox/policy-get.ts
  per single-path oclif architecture (command = argv glue, action = logic)
- Tests now assert on logged output (observable behavior)
- Add dedicated unit tests for the action layer
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: policy Network policy, egress rules, presets, or sandbox policy area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality labels Jul 1, 2026
@wscurran

wscurran commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✨ Thanks for the fix. Adding a new nemoclaw sandbox policy get command for clean YAML output solves the get/set round-trip issue cleanly.


Related open issues:

@kagura-agent

Copy link
Copy Markdown
Contributor Author

Thanks @wscurran! Happy to hear the approach works well. Let me know if you'd like any changes — happy to iterate.

@wscurran wscurran added v0.0.76 and removed v0.0.76 labels Jul 7, 2026
@apurvvkumaria apurvvkumaria self-assigned this Jul 7, 2026
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/reference/cli-selection-guide.mdx`:
- Around line 222-223: Clarify the ambiguous --full reference in the
policy-selection guide by tying it to the correct command. Update the sentence
near the references to policy-get and policy set so it explicitly says that
openshell policy get --full is used to inspect the effective policy, while
$$nemoclaw <name> policy-get remains the round-trippable base-policy path. Keep
the existing guidance but name the command directly so readers do not confuse
--full with a policy-get flag.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 16aa82c3-ef4b-4aa8-b9c7-013704cb83d6

📥 Commits

Reviewing files that changed from the base of the PR and between b5d9872 and 8ebcb15.

📒 Files selected for processing (9)
  • docs/network-policy/customize-network-policy.mdx
  • docs/network-policy/integration-policy-examples.mdx
  • docs/reference/cli-selection-guide.mdx
  • docs/reference/commands-nemohermes.mdx
  • docs/reference/commands.mdx
  • docs/reference/network-policies.mdx
  • scripts/checks/openshell-policy-mutation-read.ts
  • src/commands/sandbox/policy/get.test.ts
  • src/commands/sandbox/policy/get.ts
💤 Files with no reviewable changes (5)
  • scripts/checks/openshell-policy-mutation-read.ts
  • src/commands/sandbox/policy/get.ts
  • src/commands/sandbox/policy/get.test.ts
  • docs/reference/network-policies.mdx
  • docs/reference/commands.mdx

Comment thread docs/reference/cli-selection-guide.mdx Outdated
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria
apurvvkumaria requested a review from cv July 7, 2026 20:47
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@kagura-agent

Copy link
Copy Markdown
Contributor Author

Hi @wscurran 👋 Thanks again for the positive feedback! Just checking in — is there anything else needed for this to move toward merge? Happy to address any additional changes. 🌸

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the current head. The command reuses the existing fail-closed OpenShell policy parser, gates unparsed metadata behind --raw, wires the public CLI route, and includes focused command, action, package-contract, and documentation tests. Current-head CI and contributor-compliance gates are green.

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after the conflict-free main update. The reviewed policy-get implementation is unchanged relative to current main, all current-head CI and compliance gates pass, and the merge commit is GitHub Verified.

@ericksoa ericksoa added v0.0.78 and removed v0.0.77 labels Jul 8, 2026
@cjagwani cjagwani added v0.0.79 and removed v0.0.78 labels Jul 8, 2026
@apurvvkumaria
apurvvkumaria merged commit 34ffe04 into NVIDIA:main Jul 8, 2026
31 checks passed
@cjagwani cjagwani mentioned this pull request Jul 9, 2026
21 tasks
cv pushed a commit that referenced this pull request Jul 9, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Prepares the user documentation for NemoClaw v0.0.78 by replacing the
unreleased section with release highlights and synchronizing the
affected inference, lifecycle, messaging, and CLI reference pages with
merged behavior.

## Changes

- Publish the v0.0.78 release-notes section with links to the most
specific user guides for each shipped behavior.
- Document authoritative Deep Agents route health, Nemotron Ultra
profile behavior, and Hermes compatible-endpoint context metadata.
- Document forced rebuild recovery after total backup failure and the
ownership-safe tunnel/full-stop behavior.
- Keep command examples and shared agent variants aligned with the
current OpenClaw, Hermes, and Deep Agents interfaces.

Source mapping:

- [#3787](#3787) ->
`docs/about/release-notes.mdx`: Record reliable workspace template
seeding during sandbox startup.
- [#4960](#4960) ->
`docs/about/release-notes.mdx`: Record safer detection of rewritten
OpenClaw gateway processes.
- [#5676](#5676) ->
`docs/about/release-notes.mdx`: Record warning-tolerant agent-list JSON
handling.
- [#5857](#5857) ->
`docs/about/release-notes.mdx`: Record synchronization of explicit
OpenClaw main-agent model state.
- [#5929](#5929) ->
`docs/about/release-notes.mdx`: Record copyable SSH port-forward
guidance for remote dashboards.
- [#6068](#6068) ->
`docs/about/release-notes.mdx`: Record custom-image plugin provenance
reconciliation.
- [#6116](#6116) ->
`docs/about/release-notes.mdx`: Record live-loopback dashboard-forward
recovery.
- [#6122](#6122) ->
`docs/about/release-notes.mdx`: Announce validated, round-trippable
policy YAML output.
- [#6211](#6211) ->
`docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`,
`docs/about/release-notes.mdx`: Explain the explicit no-backup `rebuild
--force` recovery boundary.
- [#6283](#6283) ->
`docs/about/release-notes.mdx`: Record Hermes WebUI port alignment.
- [#6293](#6293) ->
`docs/inference/switch-inference-providers.mdx`,
`docs/about/release-notes.mdx`: Document compatible-endpoint
context-length probing for Hermes.
- [#6320](#6320) ->
`docs/about/release-notes.mdx`: Record bounded gateway-recovery waits.
- [#6377](#6377) ->
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Explain
rebuild diagnostics and prepared MCP-destroy recovery.
- [#6412](#6412) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document authoritative agent-visible
inference route health.
- [#6421](#6421) ->
`docs/about/release-notes.mdx`: Record the longer quiet-pull window for
managed vLLM images.
- [#6431](#6431) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document the version-pinned Nemotron
Ultra profile plugin.
- [#6439](#6439) ->
`docs/about/release-notes.mdx`: Summarize the authenticated, pinned
credential-capture helper boundary.
- [#6450](#6450) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Document
host-forward cleanup and ownership-safe gateway-port release.
- [#6474](#6474) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/about/release-notes.mdx`: Record composable OpenClaw messaging
runtime loaders.
- [#6475](#6475) ->
`docs/about/release-notes.mdx`: Record removal of the unavailable Kimi
K2.6 production endpoint option.
- [#6480](#6480) ->
`docs/about/release-notes.mdx`: Record stderr routing for the plugin
registration banner.
- [#6481](#6481) ->
`docs/about/release-notes.mdx`: Record post-pull Ollama model discovery
checks.
- [#6482](#6482) ->
`docs/about/release-notes.mdx`: Record Ollama model warm-up after daemon
restart.
- [#6486](#6486) ->
`docs/about/release-notes.mdx`: Publish the opt-in, thread-scoped Deep
Agents auto-approval boundary.
- [#6490](#6490) ->
`docs/about/release-notes.mdx`: Record diagnostics for custom images
missing the managed runtime.
- [#6494](#6494) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document nonempty tool-call content
preservation and placeholder rejection.
- [#6497](#6497) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document isolated Deep Agents
route-probe output.
- [#6506](#6506) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document observability-preserving
managed route probes.
- [#6508](#6508) ->
`docs/about/release-notes.mdx`: Link the new extension taxonomy and
SDK-readiness reference from the release summary.

Release-source verification: GitHub reports all 29 cited source PRs as
merged with base `main`, and every merge commit is an ancestor of
`origin/main` at `17bf9a6a9688b3b1d69cf4b37d3f23110acb055e`. No
source-mapping mismatches were found.

## 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)

## Quality Gates

<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: Documentation-only
release-prep changes; `npm run docs` validates variants, routes, and
Fern content.
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [ ] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: Tests
are not applicable to this documentation-only change set.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) — exited
0 with zero errors; Fern reported the existing unauthenticated
redirect-check and light-mode contrast warnings.
- [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)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

---------

Signed-off-by: cjagwani <cjagwani@nvidia.com>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
…VIDIA#6122)

<!-- markdownlint-disable MD041 -->
## Summary

Adds `nemoclaw <name> policy-get`, a public command that exports the
sandbox's round-trippable OpenShell base policy as validated YAML.
The default output strips the OpenShell metadata header and is suitable
for review, editing, and `openshell policy set`; `--raw` preserves the
unparsed metadata-bearing response for diagnostics only.

## Related Issue

Closes NVIDIA#6052.

## Changes

- Add the `sandbox:policy:get` oclif command and the public `<name>
policy-get` route.
- Read `openshell policy get --base`, not the effective `--full` policy,
so provider-composed reserved entries are never advertised as
round-trippable.
- Fail closed on empty, malformed, or unsuccessful policy reads while
preserving an explicit diagnostic-only `--raw` mode.
- Add composed fake-OpenShell coverage for exact argv, metadata
stripping, YAML parsing, malformed output, and subprocess failure.
- Replace the repeated shell/`awk` metadata workaround in the policy
documentation and regenerate the NemoHermes command reference.

## Type of Change

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

## Quality Gates

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — read-only argv execution, fail-closed parsing, and the
`--base` mutation boundary were reviewed and covered by the repository
policy-read audit.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Git hooks passed during commit and push, and `npx prek run
--from-ref origin/main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only) — not run; the
change is covered by focused CLI, integration, and package-contract
tests.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) — the
build passes with 0 errors and 2 pre-existing hidden warnings.
- [x] Doc pages follow the style guide (doc changes only)
- [x] New doc pages include SPDX header and frontmatter (new pages only)
— not applicable; no new pages were added.

## Attribution

Original implementation and PR authorship are by @kagura-agent.
Kagura's two original GitHub-Verified commits, including the original
Claude Opus 4 co-authorship trailer, are preserved unchanged.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>


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

## Summary by CodeRabbit

* **New Features**
* Added a new `policy-get` command to export a sandbox’s base network
policy, with an option to print the raw output.

* **Documentation**
* Updated CLI and network policy guides to use the new
export-and-reapply workflow.
* Clarified when to use raw output and when validation failures cause
the command to exit.

* **Tests**
* Added coverage for policy export behavior, raw output handling, error
cases, and command translation compatibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
Co-authored-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Prepares the user documentation for NemoClaw v0.0.78 by replacing the
unreleased section with release highlights and synchronizing the
affected inference, lifecycle, messaging, and CLI reference pages with
merged behavior.

## Changes

- Publish the v0.0.78 release-notes section with links to the most
specific user guides for each shipped behavior.
- Document authoritative Deep Agents route health, Nemotron Ultra
profile behavior, and Hermes compatible-endpoint context metadata.
- Document forced rebuild recovery after total backup failure and the
ownership-safe tunnel/full-stop behavior.
- Keep command examples and shared agent variants aligned with the
current OpenClaw, Hermes, and Deep Agents interfaces.

Source mapping:

- [NVIDIA#3787](NVIDIA#3787) ->
`docs/about/release-notes.mdx`: Record reliable workspace template
seeding during sandbox startup.
- [NVIDIA#4960](NVIDIA#4960) ->
`docs/about/release-notes.mdx`: Record safer detection of rewritten
OpenClaw gateway processes.
- [NVIDIA#5676](NVIDIA#5676) ->
`docs/about/release-notes.mdx`: Record warning-tolerant agent-list JSON
handling.
- [NVIDIA#5857](NVIDIA#5857) ->
`docs/about/release-notes.mdx`: Record synchronization of explicit
OpenClaw main-agent model state.
- [NVIDIA#5929](NVIDIA#5929) ->
`docs/about/release-notes.mdx`: Record copyable SSH port-forward
guidance for remote dashboards.
- [NVIDIA#6068](NVIDIA#6068) ->
`docs/about/release-notes.mdx`: Record custom-image plugin provenance
reconciliation.
- [NVIDIA#6116](NVIDIA#6116) ->
`docs/about/release-notes.mdx`: Record live-loopback dashboard-forward
recovery.
- [NVIDIA#6122](NVIDIA#6122) ->
`docs/about/release-notes.mdx`: Announce validated, round-trippable
policy YAML output.
- [NVIDIA#6211](NVIDIA#6211) ->
`docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`,
`docs/about/release-notes.mdx`: Explain the explicit no-backup `rebuild
--force` recovery boundary.
- [NVIDIA#6283](NVIDIA#6283) ->
`docs/about/release-notes.mdx`: Record Hermes WebUI port alignment.
- [NVIDIA#6293](NVIDIA#6293) ->
`docs/inference/switch-inference-providers.mdx`,
`docs/about/release-notes.mdx`: Document compatible-endpoint
context-length probing for Hermes.
- [NVIDIA#6320](NVIDIA#6320) ->
`docs/about/release-notes.mdx`: Record bounded gateway-recovery waits.
- [NVIDIA#6377](NVIDIA#6377) ->
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Explain
rebuild diagnostics and prepared MCP-destroy recovery.
- [NVIDIA#6412](NVIDIA#6412) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document authoritative agent-visible
inference route health.
- [NVIDIA#6421](NVIDIA#6421) ->
`docs/about/release-notes.mdx`: Record the longer quiet-pull window for
managed vLLM images.
- [NVIDIA#6431](NVIDIA#6431) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document the version-pinned Nemotron
Ultra profile plugin.
- [NVIDIA#6439](NVIDIA#6439) ->
`docs/about/release-notes.mdx`: Summarize the authenticated, pinned
credential-capture helper boundary.
- [NVIDIA#6450](NVIDIA#6450) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Document
host-forward cleanup and ownership-safe gateway-port release.
- [NVIDIA#6474](NVIDIA#6474) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/about/release-notes.mdx`: Record composable OpenClaw messaging
runtime loaders.
- [NVIDIA#6475](NVIDIA#6475) ->
`docs/about/release-notes.mdx`: Record removal of the unavailable Kimi
K2.6 production endpoint option.
- [NVIDIA#6480](NVIDIA#6480) ->
`docs/about/release-notes.mdx`: Record stderr routing for the plugin
registration banner.
- [NVIDIA#6481](NVIDIA#6481) ->
`docs/about/release-notes.mdx`: Record post-pull Ollama model discovery
checks.
- [NVIDIA#6482](NVIDIA#6482) ->
`docs/about/release-notes.mdx`: Record Ollama model warm-up after daemon
restart.
- [NVIDIA#6486](NVIDIA#6486) ->
`docs/about/release-notes.mdx`: Publish the opt-in, thread-scoped Deep
Agents auto-approval boundary.
- [NVIDIA#6490](NVIDIA#6490) ->
`docs/about/release-notes.mdx`: Record diagnostics for custom images
missing the managed runtime.
- [NVIDIA#6494](NVIDIA#6494) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document nonempty tool-call content
preservation and placeholder rejection.
- [NVIDIA#6497](NVIDIA#6497) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document isolated Deep Agents
route-probe output.
- [NVIDIA#6506](NVIDIA#6506) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document observability-preserving
managed route probes.
- [NVIDIA#6508](NVIDIA#6508) ->
`docs/about/release-notes.mdx`: Link the new extension taxonomy and
SDK-readiness reference from the release summary.

Release-source verification: GitHub reports all 29 cited source PRs as
merged with base `main`, and every merge commit is an ancestor of
`origin/main` at `17bf9a6a9688b3b1d69cf4b37d3f23110acb055e`. No
source-mapping mismatches were found.

## 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)

## Quality Gates

<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: Documentation-only
release-prep changes; `npm run docs` validates variants, routes, and
Fern content.
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [ ] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: Tests
are not applicable to this documentation-only change set.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) — exited
0 with zero errors; Fern reported the existing unauthenticated
redirect-check and light-mode contrast warnings.
- [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)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

---------

Signed-off-by: cjagwani <cjagwani@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: policy Network policy, egress rules, presets, or sandbox policy area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS][Policy&Network] openshell policy get --full output cannot be used directly with policy set — metadata header causes YAML parse failure

6 participants