Repository navigation
fix(sandbox): surface policy-denial logs breadcrumb in connect shells (#5978) - #6018
Conversation
Sandbox outbound egress is denied-by-default and enforced by the OpenShell L7 proxy. From inside the sandbox, generic CLIs (curl, git, wget, python) see a policy denial only as the opaque "CONNECT tunnel failed, response 403", with no pointer to the detailed allow/deny reason, which lives in the NemoClaw logs. Surface a breadcrumb on two complementary surfaces: - In-sandbox: a `# nemoclaw-policy-denial-hint` stanza emitted into /tmp/nemoclaw-proxy-env.sh (sourced by every interactive/login sandbox shell), shown once per top-level interactive TTY session and suppressible with NEMOCLAW_NO_POLICY_HINT=1. It deliberately does not wrap curl/git/wget (wrapping pipes their stderr, dropping TTY progress/colour and missing python), so every tool's output and exit code are unchanged. The sandbox name comes from OPENSHELL_SANDBOX (sanitized of control characters), with a `<name>` fallback on older OpenShell that sets it to "1". - Host-side: the `nemoclaw <name> connect` one-shot hint now also prints the breadcrumb with the real sandbox name, so the reporter's flow gets a directly runnable `nemoclaw <name> logs --tail 50` even when the in-sandbox value is unavailable. Adds regression tests (the emitted stanza is executed, plus a real-image docker E2E behind NEMOCLAW_RUN_POLICY_HINT_DOCKER_E2E=1) and a troubleshooting doc entry. Fixes #5978 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
Reporter-workflow E2E evidence (real sandbox base image)This fix's surface is the in-sandbox connect shell, so there is no host The breadcrumb is emitted once at connect-shell init by the real image hooks (dedup holds even though both This is codified as an opt-in container E2E ( NEMOCLAW_RUN_POLICY_HINT_DOCKER_E2E=1 vitest run \
test/repro-5978-policy-denial-hint.test.ts --project integration
# → 11 passed (includes "real base image: connect shell shows the breadcrumb once and curl is denied with 403")A full |
Real host-CLI E2E — reporter workflow against a worktree-built sandboxStood up an isolated sandbox built from this branch (so the image bakes in the changed This proves the full acceptance criteria end-to-end through the host CLI: the breadcrumb appears in the Note on the |
Follow-up (head |
Addressed the CodeRabbit nitpick: the breadcrumb tests no longer call the shell-private |
|
@coderabbitai review |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 2 items to resolve/justify, 0 in-scope improvements
|
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review Advisor (Nemotron Ultra) — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
Response to PR Review AdvisorThanks — addressing each open item. Summary: the connect-shell breadcrumb is the intended, deliberately-scoped solution, the host-side print is provably control-char-safe, and the denial-time tool output is owned by OpenShell, not NemoClaw. Details and the advisor's requested fields below.
|
Defense in depth for the host-side policy-denial breadcrumb (#5978): the `nemoclaw <name> connect` hint interpolates the sandbox name into a TTY message. Names are RFC-1123-validated at the policy/registry boundaries (no control characters), but route the displayed value through the existing sanitizeRouteValueForDisplay strip anyway so this sink can never be turned into a terminal-escape injection — mirroring the [:cntrl:] strip the in-sandbox stanza applies to the untrusted OPENSHELL_SANDBOX env value. For any legitimate name the strip is a no-op, so the printed command stays byte-for-byte runnable. Adds a regression test asserting the hint drops ANSI escapes and newlines from a hostile name while keeping the runnable logs command. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
Pushed
|
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a sandbox-side breadcrumb for CONNECT 403 policy denials, with label sanitization, one-time shell gating, regression coverage, an opt-in Docker E2E check, and troubleshooting guidance. ChangesPolicy-denial breadcrumb hint
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
E2E Target RecommendationRequired E2E targets: Dispatch required E2E targets:
Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/actions/sandbox/connect-policy-hint.test.ts (1)
27-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the sanitization contract, not the current stripped payload.
Line 31 hard-codes the exact
"qa[31m-5978INJECTED"output, which couples this test to the current strip-only implementation. A future sanitizer that safely falls back to<name>or drops more tainted text would still satisfy the public behavior but fail here. Assert only the observable contract: no control characters reach the hint and a logs command is still present. As per path instructions, "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."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/lib/actions/sandbox/connect.ts`:
- Around line 1099-1101: The normal connect flow is printing the policy-denial
breadcrumb twice: once in `connect` before launching `openshell sandbox
connect`, and again in the sourced shell stanza that runs in the interactive
session. Update `connect` and the shell bootstrap path so only one side emits
the hint, either by making one path authoritative or by threading a one-shot env
flag from `connect` to suppress the in-sandbox print. Use
`buildPolicyDenialConnectHint`, `isPolicyDenialHintSuppressed`, and the
`openshell sandbox connect` launch flow to locate the change.
🪄 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: 9a4f2b19-f3cf-4f1e-80fd-87ce17ae7918
📒 Files selected for processing (5)
docs/reference/troubleshooting.mdxscripts/nemoclaw-start.shsrc/lib/actions/sandbox/connect-policy-hint.test.tssrc/lib/actions/sandbox/connect.tstest/repro-5978-policy-denial-hint.test.ts
…wlist label Address PR review on #5978: - Stop printing the host-side breadcrumb in the `connect` welcome block. The in-sandbox `nemoclaw-policy-denial-hint` stanza already emits the breadcrumb once when the connect shell sources /tmp/nemoclaw-proxy-env.sh, with the real sandbox name on supported OpenShell, so printing it again on the host duplicated the hint in the normal connect flow (CodeRabbit). The stanza remains the single authoritative surface and still covers every interactive entry path. Removes buildPolicyDenialConnectHint / isPolicyDenialHintSuppressed and the host-side unit test. - Allowlist the in-sandbox label instead of merely stripping control chars: OPENSHELL_SANDBOX is interpolated into a copyable `nemoclaw … logs` command, so render it only when it is a valid RFC-1123 sandbox name (lowercase alphanumerics/hyphens, 1..63, no leading/trailing hyphen); otherwise fall back to the `<name>` placeholder. Shell `case` globs match newlines, so embedded newlines, ANSI escapes, and shell metacharacters all fall back rather than reaching the terminal or a runnable command. Updates the stanza regression tests to assert allowlist fallback for a crafted ESC/newline name and for a shell-metacharacter name. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
Pushed Double-print (CodeRabbit, functional): Removed the host-side breadcrumb print in the
Local: repro stanza test 12 pass + 1 skip (opt-in Docker E2E), 614 connect-area unit tests pass, Biome/tsc/shfmt/shellcheck clean. |
The in-sandbox policy-denial label allowlisted lowercase alphanumerics and hyphens but accepted digit-leading values like `9abc`, while the canonical sandbox-name validator (NAME_VALID_PATTERN in src/lib/name-validation.ts, /^[a-z]([a-z0-9-]*[a-z0-9])?$/) requires a leading lowercase letter. Tighten the first-character case arm to [!a-z]* so the rendered `nemoclaw <name> logs` command only ever carries a name the rest of NemoClaw would accept; digit-leading and other invalid labels fall back to the <name> placeholder. Adds a regression test for a digit-leading OPENSHELL_SANDBOX. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
Pushed
Local: repro stanza test 13 pass + 1 skip (opt-in Docker E2E); shfmt/shellcheck/Biome/tsc clean. |
…of-truth Address second-pass PR review on #5978: - Force the C locale for the in-sandbox name allowlist so the [a-z0-9-] ranges stay ASCII and are not widened by the caller's LC_COLLATE/LC_CTYPE. Safe because the label helper only runs inside command substitution. - Document the source-of-truth in the stanza comment: the 403 is emitted by the OpenShell L7 proxy (separate codebase/release), so it cannot be made self-describing here; records the regression test and the removal condition (drop once OpenShell returns a structured denial at the tunnel-failure site). - Expand docs/troubleshooting: spell out the hint's gating conditions (proxy configured, interactive TTY on stderr, top-level shell, suppressible) and the OpenShell version dependency for the real-name vs <name> placeholder. - Add regression tests for an over-length (>63) OPENSHELL_SANDBOX falling back to <name>. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
Response to PR Review Advisor (Nemotron Ultra) + acceptance follow-upsPushed Fixed in code
Stale — reference code that was already removed
Justified — no change (would regress or out of scope)
Local validation: repro stanza test 14 pass + 1 skip (opt-in Docker E2E); |
PR Review Advisor PRA-1 (acceptance) asked to either make the breadcrumb denial-adjacent or explicitly narrow the accepted contract to a proactive connect-shell reminder, in code/docs/tests, with maintainer agreement. A tool-agnostic denial-adjacent breadcrumb is not achievable from NemoClaw: the 403 is emitted by the OpenShell L7 proxy (separate codebase), and the only in-sandbox alternative — wrapping curl/git/wget — pipes their stderr (dropping TTY progress/colour, risking exit-code changes) and still misses python. The maintainer accepted the proactive connect-shell + in-sandbox reminder as the supported contract. Record that agreement where the advisor asked: - test: add a proactive-only contract assertion that the emitted stanza never wraps or aliases curl/git/wget, plus a docblock note. - code: note the accepted contract in the nemoclaw-start.sh stanza comment. - docs: clarify in troubleshooting that the reminder is intentionally proactive and the tool error text is left unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
Manual review (covering the Nemotron Ultra advisor 'PR review advisor unavailable' item, which has not produced a substantive review across re-runs). I re-triggered the PR Review Advisor workflow (runs 28424113090, 28424442004); the Nemotron variant keeps returning
No blocking issues found in this manual review; the one design point (proactive-only) has maintainer acceptance recorded on #5978 and in this PR. |
…ource text The source-shape budget (0) forbids source-text assertions. The proactive-only contract test matched the stanza source, tripping 'Source-shape test budget exceeded: 1 > 0' in static-checks. Convert it to a behavior test: source the stanza, then assert curl/git/wget resolve to a binary (not a shell function/alias) via `type -t`, proving the tools are left unwrapped. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
@coderabbitai review |
✅ Action performedReview finished.
|
…interactive (#5978) Strengthen the opt-in real-base-image E2E to cover the runtime-validation follow-ups: drive both reporter commands (curl and git clone) under a real 403-on-CONNECT denial and assert each keeps its own native error and non-zero exit status (curl 56, git 128), neither tool is wrapped/aliased (type -t == file), the breadcrumb prints exactly once per session, and a noninteractive shell stays silent. Proves the proactive-only contract end to end against the image's own /etc/profile.d + /etc/bash.bashrc hooks. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
…allowlist case (#5978) Add a pointer comment at the OPENSHELL_SANDBOX allowlist `case` so a future maintainer editing the pattern sees the src/lib/name-validation.ts source of truth right where the match happens, keeping the shell allowlist and the TS NAME_VALID_PATTERN in sync. Comment-only; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
…nvalid-name fallback (#5978) Add always-run allowlist coverage for two more invalid OPENSHELL_SANDBOX shapes the gate must reject — uppercase-leading (Qa-5978) and underscore (qa_5978) — both falling back to the <name> placeholder rather than echoing the untrusted value. Clarify in runInPty that a snippet's own SHLVL assignment takes precedence over the forced inherited SHLVL=9 (intentional). Document the invalid-name fallback for safety in the troubleshooting page. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
…uard drift (#5978) Add a behavioral anti-drift test that runs a matrix of candidate names through the real shell gate and asserts its accept/reject decision matches the imported NAME_VALID_PATTERN/NAME_MAX_LENGTH from src/lib/name-validation.ts. A future change to the TS validator that the hand-mirrored shell `case` does not track now fails here. Boolean sentinels (true/false/0/1) are intentionally excluded — the shell maps them to the placeholder by OpenShell convention. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
…5978) Justify keeping the real-base-image E2E opt-in rather than a required CI lane: it needs a Docker daemon plus the multi-hundred-MB sandbox base image that the fast always-run lanes do not provision, while the behavior is already covered hermetically by the always-run stanza tests. The scenario is the end-to-end reporter-workflow proof for local/image-aware runs; promote it once such a lane exists. Comment-only; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yimo Jiang <[email protected]>
|
@coderabbitai review |
✅ Action performedReview finished.
|
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed. Additive policy-denial breadcrumb for connect shells: does NOT wrap curl/git/wget (preserves their TTY/exit behaviour), gated once-per-session on interactive+TTY+proxy, suppressible via NEMOCLAW_NO_POLICY_HINT. Untrusted OPENSHELL_SANDBOX is allowlisted against RFC-1123 (NAME_VALID_PATTERN) with an anti-drift test — injection-safe. Touches the sandbox entrypoint but is purely informational. Thorough PTY tests + opt-in real-image E2E. Advisors + CodeRabbit + E2E + CI green. LGTM.
Vitest E2E Target Results — ✅ All requested jobs passedRun: 28540976325
|
|
CodeRabbit finding at |
## Summary - Add the `v0.0.72` release-note section with links to the deeper docs pages for installer recovery, command diagnostics, inference, policy, and sandbox repair changes. - Document the custom preset `allowed_ips` guard for user-authored policy files. ## Related Issue None. ## Source summary - #6132 -> `docs/about/release-notes.mdx`: Summarizes installer and upgrade recovery before generic onboarding, with links to quickstart and lifecycle docs. - #6087 -> `docs/network-policy/customize-network-policy.mdx`: Documents that user-authored custom presets reject `allowed_ips` for ordinary endpoints; also summarized in release notes. - #5975 -> `docs/about/release-notes.mdx`: Summarizes safer curl-based inference probes that keep API keys out of process arguments. - #6044 -> `docs/about/release-notes.mdx`: Summarizes compact `channels status` configuration reporting. - #6096 -> `docs/about/release-notes.mdx`: Summarizes OpenClaw EC2 metadata discovery disablement and links to security guidance. - #5980 and #5991 -> `docs/about/release-notes.mdx`: Summarizes `exec` multiline argument rejection and recovery guidance. - #6023 -> `docs/about/release-notes.mdx`: Summarizes registered-provider diagnostics for `inference set` failures. - #6074 -> `docs/about/release-notes.mdx`: Summarizes the refreshed NVIDIA Endpoints featured-model selection behavior. - #5969 -> `docs/about/release-notes.mdx`: Summarizes `credentials add` provider credential registration. - #6060 -> `docs/about/release-notes.mdx`: Summarizes mutable OpenClaw config permission restoration after `exec`. - #6134 -> `docs/about/release-notes.mdx`: Summarizes restored Tavily access for managed Python workflows. - #6089 -> `docs/about/release-notes.mdx`: Summarizes Hermes runtime version-scheme comparison during upgrade checks. - #6131 -> `docs/about/release-notes.mdx`: Summarizes OpenClaw gateway watchdog recovery behavior. - #5976 and #5990 -> `docs/about/release-notes.mdx`: Summarizes prompt stdin EOF cancellation behavior during onboarding. - #5540 -> `docs/about/release-notes.mdx`: Summarizes clarified host-level and per-sandbox status command scope. - #5978 and #6018 -> `docs/about/release-notes.mdx`: Summarizes policy-denial log breadcrumbs in connect shells. ## Testing - `npm run docs:sync-agent-variants` - `npm run docs` - Commit hooks passed during `git commit`, including commitlint and gitleaks. - Pre-push hook passed during `git push`, including TypeScript CLI and package/tag version sync. ## Checklist - [x] Documentation updated. - [x] `npm run docs` completed with 0 errors and 1 existing Fern warning. - [x] No source code or generated build artifacts committed. Signed-off-by: Miyoung Choi <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added release notes for v0.0.72 covering improved installer recovery, clearer CLI diagnostics, safer inference setup and provider switching, better credential handling, stronger policy boundaries, and more robust runtime repair behavior. * Updated network policy guidance to clarify when `allowed_ips` can be used, including a specific exception for the sandbox-to-host bridge endpoint. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
#6238) <!-- markdownlint-disable MD041 --> ## Summary A sandbox network-policy denial reaches generic clients (curl, python, git, wget, …) only as the opaque `curl: (56) CONNECT tunnel failed, response 403`; the denial reason lives in the audit log but the reporter's `nemoclaw <name> exec -- ...` failure path pointed nowhere. This PR makes that exact failure path actionable: after a failed exec, NemoClaw reads recent audit logs and, only when a fresh policy denial is found, appends a concise host-side stderr breadcrumb — while preserving the tool's own output and exit code. The prior startup banner (#6018) only covered top-level interactive connect shells, leaving the QA/exec path opaque; this closes that gap. ## Related Issue Fixes #5978 ## Changes - New `src/lib/actions/sandbox/exec-policy-hint.ts`: - Tool-/format-agnostic denial detection (OpenShell OCSF `NET:OPEN … DENIED`, `policy_denied`, `not … by policy`). - Safe `host:port` extraction (strict allowlist; leading log timestamp stripped so an ISO stamp's `HH:MM` is never mistaken for the endpoint; crafted/control-char tokens dropped → generic message). No log line or secret is echoed — only the `host:port`. - Exact-cutoff recency check (no backward skew), so a denial from a *prior* command cannot masquerade as this one's → no spam on unrelated failures. - Bounded audit-log read retry for slow-flushing events (audit enabled once, only the read retries). - Wire into `execSandbox` after the child is reaped and after invocation/cleanup diagnostics; the child's stdout/stderr bytes and the exec exit code are untouched (best-effort, never throws to the caller). - Docs: `docs/reference/troubleshooting.mdx` entry for the exec breadcrumb. The connect-shell stanza and its tests are intentionally left in place (they cover the interactive path and stay silent noninteractively, which remains correct); this PR adds the host-side exec coverage the reporter's workflow actually needs. ## Type of Change - [x] Code change with doc updates ## Quality Gates - [x] Tests added or updated for changed behavior — new `exec-policy-hint.test.ts` (37 cases: detection, safe extraction incl. injection/ISO, recency cutoff, retry, exit-preservation guards); existing exec suites still pass. - [x] Docs updated for user-facing behavior changes — troubleshooting entry. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) — sandbox/policy/observability; no secrets are read into the hint (only `host:port`, allowlisted). - [x] Sensitive-path review completed — `codex review --uncommitted` run across iterations; findings addressed (test-title style, backward-skew false positive, ISO-timestamp endpoint poisoning, one-shot→bounded-retry). A self-caught event-loop-drain bug (an `unref`'d retry timer let Node exit 0 mid-retry and drop the real exit code) was fixed and covered by E2E. ## 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 (`npx prek run --all-files --stage pre-push` → all TypeScript checks Passed) - [x] Targeted tests pass for changed behavior - [x] No secrets, API keys, or credentials committed ### Real-CLI E2E (restricted ollama sandbox `oc5978`, worktree `./bin/nemoclaw.js`) ``` node ./bin/nemoclaw.js oc5978 exec -- bash -lc "curl -sS --max-time 15 https://example.com/" # curl: (56) CONNECT tunnel failed, response 403 # nemoclaw: recent network policy denial detected for example.com:443 inside sandbox 'oc5978'. # The sandbox's egress policy blocked this request; the tool above only saw the proxy's 403. # See the denied flow: nemoclaw oc5978 logs --tail 50 # Review or allow the host: nemoclaw oc5978 policy-list # Silence this hint: export NEMOCLAW_NO_POLICY_HINT=1 # exit 56 ``` Full matrix confirmed against the live sandbox: - `curl` denial → hint + exit **56**; `python` urllib denial → hint + exit **1**; `git clone` denial → hint + exit **128** (native errors preserved, tool-agnostic). - `echo ok` → **no hint**, exit **0**; `ls /nope` → **no hint**, exit **2**; `false` → exit **1** (no spam on unrelated failures; exit codes preserved). - `NEMOCLAW_NO_POLICY_HINT=1 … curl …` → **no hint**, exit **56**. - `node ./bin/nemoclaw.js oc5978 logs --tail 50` shows the matching `NET:OPEN … DENIED … -> example.com:443 … not allowed by any policy` audit line. --- Signed-off-by: Yimo Jiang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Failed sandbox `exec` commands now emit an optional stderr “network policy denial” breadcrumb with a sanitized denied `host:port` (bracketed IPv6 supported) and follow-ups (`logs --tail`, `policy-list`, `policy-add`). * Interactive `connect` guidance includes an updated one-line denial signature reminder and the `logs` command. * **Bug Fixes** * Breadcrumbs appear only for genuinely *fresh* denials; otherwise nothing is emitted, and the original command exit code is preserved. Supports opt-out via `NEMOCLAW_NO_POLICY_HINT`. * **Documentation** * Updated the `CONNECT tunnel failed, response 403` troubleshooting section and clarified `policy-add` preset behavior. * **Tests** * Added unit/integration/e2e coverage for detection, safe parsing, retry probing, suppression, and failure-handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Yimo Jiang <[email protected]> Signed-off-by: Aaron Erickson <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Aaron Erickson <[email protected]>
…NVIDIA#5978) (NVIDIA#6018) ## Summary Sandbox outbound egress is denied-by-default and enforced by the OpenShell L7 proxy. From inside the sandbox, generic CLIs (curl, git, wget, python) see a policy denial only as the opaque `CONNECT tunnel failed, response 403`, with no pointer to the detailed allow/deny reason that lives in the NemoClaw logs. This adds a tool-agnostic breadcrumb that points the user to `nemoclaw <name> logs --tail 50`. ## Related Issue Fixes NVIDIA#5978 ## Changes - `scripts/nemoclaw-start.sh`: add a `# nemoclaw-policy-denial-hint` stanza to the `/tmp/nemoclaw-proxy-env.sh` block already sourced by every interactive/login sandbox shell (via `/etc/bash.bashrc` and `/etc/profile.d/nemoclaw-proxy.sh`). It prints a one-line breadcrumb naming the `CONNECT tunnel failed, response 403` signature and `nemoclaw <name> logs --tail 50`. - Shown **once** per top-level interactive TTY session (gated on `$-` interactive, `[ -t 2 ]`, `SHLVL <= 1`, a proxy being configured, and a once-per-shell guard so a login shell sourcing both `/etc/profile` and `/etc/bash.bashrc` does not double-print). Suppressible with `NEMOCLAW_NO_POLICY_HINT=1`. - The sandbox name is derived from `OPENSHELL_SANDBOX` (OpenShell ≥0.0.44), falling back to `<name>` on older versions. - It deliberately does **not** wrap `curl`/`git`/`wget`: wrapping them to scan stderr turns their stderr into a pipe, makes the tools drop progress meters and colour, and still misses `python`. The informational hint leaves every tool's stdout/stderr/TTY behaviour and exit code byte-for-byte unchanged, while covering generic CLIs — not just Node processes (the explicit risk called out in the issue). - `test/repro-5978-policy-denial-hint.test.ts`: executes the actual emitted stanza (extracted from the single-quoted heredoc, byte-identical to runtime) and asserts the breadcrumb content, name derivation/fallback, the suppress/no-proxy/non-interactive/subshell gates, and single-print on double-source. - `docs/reference/troubleshooting.mdx`: new entry "A request inside the sandbox fails with `CONNECT tunnel failed, response 403`". `nemoclaw <name> logs --tail 50` already surfaces the merged OpenShell denial line, so no logs-path change is required. ## Type of Change - [x] Code change with doc updates ## Quality Gates - [x] Tests added or updated for changed behavior - [x] Docs updated for user-facing behavior changes - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — justification: additive, informational stderr output only; no policy/enforcement/credential behaviour changes; tools are not wrapped so their behaviour and exit codes are unchanged. ## Verification Real reporter-workflow E2E with the host CLI, against a sandbox built from this branch (the image bakes in the changed `nemoclaw-start.sh`): ```bash node ./bin/nemoclaw.js onboard --name issue5978-hint --non-interactive --yes --no-gpu --no-sandbox-gpu --agent openclaw node ./bin/nemoclaw.js issue5978-hint connect node ./bin/nemoclaw.js issue5978-hint logs --tail 50 ``` The `connect` shell printed the breadcrumb, a real `curl` was denied with `CONNECT tunnel failed, response 403`, and `logs --tail 50` showed the denial reason (`DENIED` on `example.com:443`, `not in policy`). Full transcript in the PR comment. - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Targeted tests pass — `vitest run test/repro-5978-policy-denial-hint.test.ts` (13 passing incl. the opt-in real-image container E2E; deterministic under `env -u SHLVL`) - [x] Targeted regression tests pass: repro-4538, runtime-env-alias, slack/telegram/plugin-refresh/reconcile, nemoclaw-start, hermes-start - [x] `shfmt -i 2 -ci -bn` clean; Biome clean; `tsc -p jsconfig.json` clean; source-shape budget 0; codebase-growth-guardrails pass - [x] `npm run docs` builds without warnings - [x] No secrets, API keys, or credentials committed --- Signed-off-by: Yimo Jiang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved in-sandbox outbound troubleshooting by showing a clear `CONNECT tunnel failed, response 403` breadcrumb with a copyable `nemoclaw <name> logs --tail 50` hint. * Ensures the hint is emitted only once per interactive top-level shell session, with suppression via `NEMOCLAW_NO_POLICY_HINT=1`, and avoids duplicate breadcrumbs in the host connect flow. * **Documentation** * Expanded the Runtime troubleshooting guide with the new in-sandbox outbound failure section, including how to identify the denied rule and remediate via `policy-add <preset>` (custom presets supported). * **Tests** * Added regression coverage for PTY vs non-PTY behavior, suppression, safe `<name>` derivation from sandbox labels, and an optional Docker-gated end-to-end check. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Accepted contract (proposed contributor scope) Per PR Review Advisor `PRA-1` (acceptance): the supported behavior for NVIDIA#5978 is a **proactive** connect-shell + in-sandbox reminder, **not** a denial-time rewrite of the `curl`/`git`/`wget` error. The denial-time `CONNECT tunnel failed, response 403` is emitted by the OpenShell L7 egress proxy (a separate codebase/release), so it cannot be made self-describing from this repo, and wrapping the tools to inject text is rejected (it pipes their stderr — dropping TTY progress/colour, risking exit-code changes — and still misses `python`). Contributor position: this PR intentionally implements the proactive reminder only; repository reviewers must decide whether that scope is acceptable. It is recorded in code (`scripts/nemoclaw-start.sh` stanza comment), docs (`docs/reference/troubleshooting.mdx`), and tests (the "proactive-only contract" assertion in `test/repro-5978-policy-denial-hint.test.ts`). Removal condition: drop the breadcrumb once OpenShell surfaces a structured, actionable denial at the tunnel-failure site. --------- Signed-off-by: Yimo Jiang <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Prekshi Vyas <[email protected]> Co-authored-by: J. Yaunches <[email protected]>
## Summary - Add the `v0.0.72` release-note section with links to the deeper docs pages for installer recovery, command diagnostics, inference, policy, and sandbox repair changes. - Document the custom preset `allowed_ips` guard for user-authored policy files. ## Related Issue None. ## Source summary - NVIDIA#6132 -> `docs/about/release-notes.mdx`: Summarizes installer and upgrade recovery before generic onboarding, with links to quickstart and lifecycle docs. - NVIDIA#6087 -> `docs/network-policy/customize-network-policy.mdx`: Documents that user-authored custom presets reject `allowed_ips` for ordinary endpoints; also summarized in release notes. - NVIDIA#5975 -> `docs/about/release-notes.mdx`: Summarizes safer curl-based inference probes that keep API keys out of process arguments. - NVIDIA#6044 -> `docs/about/release-notes.mdx`: Summarizes compact `channels status` configuration reporting. - NVIDIA#6096 -> `docs/about/release-notes.mdx`: Summarizes OpenClaw EC2 metadata discovery disablement and links to security guidance. - NVIDIA#5980 and NVIDIA#5991 -> `docs/about/release-notes.mdx`: Summarizes `exec` multiline argument rejection and recovery guidance. - NVIDIA#6023 -> `docs/about/release-notes.mdx`: Summarizes registered-provider diagnostics for `inference set` failures. - NVIDIA#6074 -> `docs/about/release-notes.mdx`: Summarizes the refreshed NVIDIA Endpoints featured-model selection behavior. - NVIDIA#5969 -> `docs/about/release-notes.mdx`: Summarizes `credentials add` provider credential registration. - NVIDIA#6060 -> `docs/about/release-notes.mdx`: Summarizes mutable OpenClaw config permission restoration after `exec`. - NVIDIA#6134 -> `docs/about/release-notes.mdx`: Summarizes restored Tavily access for managed Python workflows. - NVIDIA#6089 -> `docs/about/release-notes.mdx`: Summarizes Hermes runtime version-scheme comparison during upgrade checks. - NVIDIA#6131 -> `docs/about/release-notes.mdx`: Summarizes OpenClaw gateway watchdog recovery behavior. - NVIDIA#5976 and NVIDIA#5990 -> `docs/about/release-notes.mdx`: Summarizes prompt stdin EOF cancellation behavior during onboarding. - NVIDIA#5540 -> `docs/about/release-notes.mdx`: Summarizes clarified host-level and per-sandbox status command scope. - NVIDIA#5978 and NVIDIA#6018 -> `docs/about/release-notes.mdx`: Summarizes policy-denial log breadcrumbs in connect shells. ## Testing - `npm run docs:sync-agent-variants` - `npm run docs` - Commit hooks passed during `git commit`, including commitlint and gitleaks. - Pre-push hook passed during `git push`, including TypeScript CLI and package/tag version sync. ## Checklist - [x] Documentation updated. - [x] `npm run docs` completed with 0 errors and 1 existing Fern warning. - [x] No source code or generated build artifacts committed. Signed-off-by: Miyoung Choi <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added release notes for v0.0.72 covering improved installer recovery, clearer CLI diagnostics, safer inference setup and provider switching, better credential handling, stronger policy boundaries, and more robust runtime repair behavior. * Updated network policy guidance to clarify when `allowed_ips` can be used, including a specific exception for the sandbox-to-host bridge endpoint. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…A#5978) (NVIDIA#6238) <!-- markdownlint-disable MD041 --> ## Summary A sandbox network-policy denial reaches generic clients (curl, python, git, wget, …) only as the opaque `curl: (56) CONNECT tunnel failed, response 403`; the denial reason lives in the audit log but the reporter's `nemoclaw <name> exec -- ...` failure path pointed nowhere. This PR makes that exact failure path actionable: after a failed exec, NemoClaw reads recent audit logs and, only when a fresh policy denial is found, appends a concise host-side stderr breadcrumb — while preserving the tool's own output and exit code. The prior startup banner (NVIDIA#6018) only covered top-level interactive connect shells, leaving the QA/exec path opaque; this closes that gap. ## Related Issue Fixes NVIDIA#5978 ## Changes - New `src/lib/actions/sandbox/exec-policy-hint.ts`: - Tool-/format-agnostic denial detection (OpenShell OCSF `NET:OPEN … DENIED`, `policy_denied`, `not … by policy`). - Safe `host:port` extraction (strict allowlist; leading log timestamp stripped so an ISO stamp's `HH:MM` is never mistaken for the endpoint; crafted/control-char tokens dropped → generic message). No log line or secret is echoed — only the `host:port`. - Exact-cutoff recency check (no backward skew), so a denial from a *prior* command cannot masquerade as this one's → no spam on unrelated failures. - Bounded audit-log read retry for slow-flushing events (audit enabled once, only the read retries). - Wire into `execSandbox` after the child is reaped and after invocation/cleanup diagnostics; the child's stdout/stderr bytes and the exec exit code are untouched (best-effort, never throws to the caller). - Docs: `docs/reference/troubleshooting.mdx` entry for the exec breadcrumb. The connect-shell stanza and its tests are intentionally left in place (they cover the interactive path and stay silent noninteractively, which remains correct); this PR adds the host-side exec coverage the reporter's workflow actually needs. ## Type of Change - [x] Code change with doc updates ## Quality Gates - [x] Tests added or updated for changed behavior — new `exec-policy-hint.test.ts` (37 cases: detection, safe extraction incl. injection/ISO, recency cutoff, retry, exit-preservation guards); existing exec suites still pass. - [x] Docs updated for user-facing behavior changes — troubleshooting entry. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) — sandbox/policy/observability; no secrets are read into the hint (only `host:port`, allowlisted). - [x] Sensitive-path review completed — `codex review --uncommitted` run across iterations; findings addressed (test-title style, backward-skew false positive, ISO-timestamp endpoint poisoning, one-shot→bounded-retry). A self-caught event-loop-drain bug (an `unref`'d retry timer let Node exit 0 mid-retry and drop the real exit code) was fixed and covered by E2E. ## 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 (`npx prek run --all-files --stage pre-push` → all TypeScript checks Passed) - [x] Targeted tests pass for changed behavior - [x] No secrets, API keys, or credentials committed ### Real-CLI E2E (restricted ollama sandbox `oc5978`, worktree `./bin/nemoclaw.js`) ``` node ./bin/nemoclaw.js oc5978 exec -- bash -lc "curl -sS --max-time 15 https://example.com/" # curl: (56) CONNECT tunnel failed, response 403 # nemoclaw: recent network policy denial detected for example.com:443 inside sandbox 'oc5978'. # The sandbox's egress policy blocked this request; the tool above only saw the proxy's 403. # See the denied flow: nemoclaw oc5978 logs --tail 50 # Review or allow the host: nemoclaw oc5978 policy-list # Silence this hint: export NEMOCLAW_NO_POLICY_HINT=1 # exit 56 ``` Full matrix confirmed against the live sandbox: - `curl` denial → hint + exit **56**; `python` urllib denial → hint + exit **1**; `git clone` denial → hint + exit **128** (native errors preserved, tool-agnostic). - `echo ok` → **no hint**, exit **0**; `ls /nope` → **no hint**, exit **2**; `false` → exit **1** (no spam on unrelated failures; exit codes preserved). - `NEMOCLAW_NO_POLICY_HINT=1 … curl …` → **no hint**, exit **56**. - `node ./bin/nemoclaw.js oc5978 logs --tail 50` shows the matching `NET:OPEN … DENIED … -> example.com:443 … not allowed by any policy` audit line. --- Signed-off-by: Yimo Jiang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Failed sandbox `exec` commands now emit an optional stderr “network policy denial” breadcrumb with a sanitized denied `host:port` (bracketed IPv6 supported) and follow-ups (`logs --tail`, `policy-list`, `policy-add`). * Interactive `connect` guidance includes an updated one-line denial signature reminder and the `logs` command. * **Bug Fixes** * Breadcrumbs appear only for genuinely *fresh* denials; otherwise nothing is emitted, and the original command exit code is preserved. Supports opt-out via `NEMOCLAW_NO_POLICY_HINT`. * **Documentation** * Updated the `CONNECT tunnel failed, response 403` troubleshooting section and clarified `policy-add` preset behavior. * **Tests** * Added unit/integration/e2e coverage for detection, safe parsing, retry probing, suppression, and failure-handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Yimo Jiang <[email protected]> Signed-off-by: Aaron Erickson <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Aaron Erickson <[email protected]>
Summary
Sandbox outbound egress is denied-by-default and enforced by the OpenShell L7 proxy. From inside the sandbox, generic CLIs (curl, git, wget, python) see a policy denial only as the opaque
CONNECT tunnel failed, response 403, with no pointer to the detailed allow/deny reason that lives in the NemoClaw logs. This adds a tool-agnostic breadcrumb that points the user tonemoclaw <name> logs --tail 50.Related Issue
Fixes #5978
Changes
scripts/nemoclaw-start.sh: add a# nemoclaw-policy-denial-hintstanza to the/tmp/nemoclaw-proxy-env.shblock already sourced by every interactive/login sandbox shell (via/etc/bash.bashrcand/etc/profile.d/nemoclaw-proxy.sh). It prints a one-line breadcrumb naming theCONNECT tunnel failed, response 403signature andnemoclaw <name> logs --tail 50.$-interactive,[ -t 2 ],SHLVL <= 1, a proxy being configured, and a once-per-shell guard so a login shell sourcing both/etc/profileand/etc/bash.bashrcdoes not double-print). Suppressible withNEMOCLAW_NO_POLICY_HINT=1.OPENSHELL_SANDBOX(OpenShell ≥0.0.44), falling back to<name>on older versions.curl/git/wget: wrapping them to scan stderr turns their stderr into a pipe, makes the tools drop progress meters and colour, and still missespython. The informational hint leaves every tool's stdout/stderr/TTY behaviour and exit code byte-for-byte unchanged, while covering generic CLIs — not just Node processes (the explicit risk called out in the issue).test/repro-5978-policy-denial-hint.test.ts: executes the actual emitted stanza (extracted from the single-quoted heredoc, byte-identical to runtime) and asserts the breadcrumb content, name derivation/fallback, the suppress/no-proxy/non-interactive/subshell gates, and single-print on double-source.docs/reference/troubleshooting.mdx: new entry "A request inside the sandbox fails withCONNECT tunnel failed, response 403".nemoclaw <name> logs --tail 50already surfaces the merged OpenShell denial line, so no logs-path change is required.Type of Change
Quality Gates
Verification
Real reporter-workflow E2E with the host CLI, against a sandbox built from this branch (the image bakes in the changed
nemoclaw-start.sh):The
connectshell printed the breadcrumb, a realcurlwas denied withCONNECT tunnel failed, response 403, andlogs --tail 50showed the denial reason (DENIEDonexample.com:443,not in policy). Full transcript in the PR comment.Verifiedin GitHubvitest run test/repro-5978-policy-denial-hint.test.ts(13 passing incl. the opt-in real-image container E2E; deterministic underenv -u SHLVL)shfmt -i 2 -ci -bnclean; Biome clean;tsc -p jsconfig.jsonclean; source-shape budget 0; codebase-growth-guardrails passnpm run docsbuilds without warningsSigned-off-by: Yimo Jiang [email protected]
Summary by CodeRabbit
CONNECT tunnel failed, response 403breadcrumb with a copyablenemoclaw <name> logs --tail 50hint.NEMOCLAW_NO_POLICY_HINT=1, and avoids duplicate breadcrumbs in the host connect flow.policy-add <preset>(custom presets supported).<name>derivation from sandbox labels, and an optional Docker-gated end-to-end check.Accepted contract (proposed contributor scope)
Per PR Review Advisor
PRA-1(acceptance): the supported behavior for #5978 is a proactive connect-shell + in-sandbox reminder, not a denial-time rewrite of thecurl/git/wgeterror. The denial-timeCONNECT tunnel failed, response 403is emitted by the OpenShell L7 egress proxy (a separate codebase/release), so it cannot be made self-describing from this repo, and wrapping the tools to inject text is rejected (it pipes their stderr — dropping TTY progress/colour, risking exit-code changes — and still missespython). Contributor position: this PR intentionally implements the proactive reminder only; repository reviewers must decide whether that scope is acceptable. It is recorded in code (scripts/nemoclaw-start.shstanza comment), docs (docs/reference/troubleshooting.mdx), and tests (the "proactive-only contract" assertion intest/repro-5978-policy-denial-hint.test.ts). Removal condition: drop the breadcrumb once OpenShell surfaces a structured, actionable denial at the tunnel-failure site.