Skip to content

fix(policy): verify preset removal against operator-owned rules - #12983

Merged
ericksoa merged 2 commits into
mainfrom
fix/12048-policy-remove-verification
Oct 12, 2026
Merged

ericksoa merged 2 commits into
mainfrom
fix/12048-policy-remove-verification

Conversation

@ericksoa

@ericksoa ericksoa commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Outcome

Removing a policy preset returns success when OpenShell adds provider-composed entries to readback and every requested operator-owned rule matches. Missing or changed operator-owned rules still fail verification.

Reason

NemoClaw already strips reserved _provider_* entries before policy writes, but compared the complete readback afterward. This produced a failure result even when the requested preset was removed.

Related issues

Fixes #12048. Replays #12111 from Cestercian; keep the original open until this replay lands.

Changes

  • Use the existing provider-entry stripping boundary for policy comparison.
  • Retain the contributor's regression case, including rejection when an unrelated host grant disappears.
  • No policy preset, dependency, or E2E assertion changes.

Verification

  • The contributor's regression reproduced on unpatched main: the preset disappeared and the host grant remained, but removal returned false. The corrected case also rejects readback that loses the unrelated host grant.
  • Final-head policy validation covers 701 passing tests and one skipped test across 35 files. One help-routing test initially timed out; after building the current CLI, its unchanged four-test file passed. CLI build and typecheck passed.
  • Automatic CI and CodeRabbit passed on 1ac92b5ded87b73a3e68f13283e9c6a6bac83e09. CodeRabbit reported minimal merge risk and no actionable comments.
  • Both complete, unfiltered default Docker/Podman fanouts completed: PR head and exact baseline 9cd663f. The PR reuses the immutable base-image cohort from that baseline; no image inputs changed.

Do no harm verified on the unchanged head. Each of the 43 original head failures either subsequently passed (18) or matches a retained exact-baseline cause at the same stage (25). The complete E2E workflow remains red for inherited failures; this is a comparison verdict, not a claim that every E2E test passes.

The previously unresolved live cases were run sequentially using the original full workflow's unexpired, staged toolchains:

Case Result
OpenClaw full suite / Docker Passed
OpenClaw full suite / Podman Passed
Hosted-turn performance / Docker Passed
Hosted-turn performance / Podman Passed
Public skill lifecycle / Podman Passed
OpenClaw security / Podman Passed
Deep Agents Code fresh onboarding / Podman Nine functional phases passed; inherited cleanup failure

Deep Agents Code completed all nine functional phases, including fresh re-onboarding, cloud checks, export, and final-state verification. Its only failure is permission-denied cleanup of /sandbox/.openclaw/workspace/POLICY.md and /sandbox/.openclaw/agents/main/sessions; both paths and the same cleanup refusal are also recorded in the baseline.

Other retained baseline failures include unsupported V1 messaging/configuration export, legacy custom-image/build-contract failures, Hermes initial model mismatch, Pi HTTP 401, sibling-create identity/recovery refusal, Slack credential-isolation assertions, native-home cleanup, publication health failures, and NIM disk exhaustion. Matching names alone were not used to clear them. The earlier provider-selection timing failure was traced to HTTP 429 retry waits and then cleared by a complete passing OpenClaw run.

No production, dependency, workflow, or E2E assertion changes were made during this comparison.

Review notes

The two policy paths are sensitive. Self-review checked strict matching of operator-owned fields, reserved provider ownership, invalid-document rejection, and preservation of the effective-policy concurrency check. The original PR's approval refers to an older commit; it does not approve this replay. CodeRabbit reviewed the published commit and reported no actionable comments; human approval remains separate from the original fork review.


Co-authored-by: Cestercian [email protected]
Signed-off-by: Aaron Erickson [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Preset removal now succeeds when provider-added policy entries differ, while preserving those entries. Removal still fails if required base policy entries are missing.
  • Tests
    • Added coverage for provider policy changes during preset removal and for missing required policy entries.

ericksoa and others added 2 commits October 10, 2026 14:34
Ignore provider-composed readback entries when comparing policy documents.
Keep strict matching for every operator-owned rule and preserve rejection
of malformed policy documents.

Fixes #12048
Replays the narrow fix from #12111.

Co-authored-by: Cestercian <[email protected]>
Signed-off-by: Aaron Erickson <[email protected]>
@ericksoa ericksoa self-assigned this Oct 11, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NemoClaw/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: dee8e695-e78e-4325-8a9e-369d1327f146



📥 Commits

Reviewing files that changed from the base of the PR and between 9cd663f and 1ac92b5.




📒 Files selected for processing (2)
  • src/lib/policy/index.ts
  • src/lib/policy/policy-live-state.test.ts



Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.





📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

policyDocumentsMatch now ignores provider-composed policy entries when comparing documents. Regression tests cover preset removal when the writer adds a provider entry or removes a base policy entry.

Changes

Policy Removal Verification

Layer / File(s) Summary
Policy matching and removal regression tests
src/lib/policy/index.ts, src/lib/policy/policy-live-state.test.ts
policyDocumentsMatch removes provider-composed entries before comparing policies. Tests verify that preset removal succeeds when the writer adds _provider_token and retains host_approval, and fails when the resulting policy is missing host_approval.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: rsliter





Merge Risk: ⚪ Minimal · up to 1ac92

Removing a policy preset should no longer fail only because provider-composed entries appear in the readback. Operator-owned rule mismatches are still rejected. No actionable merge-blocking risk was identified.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed The changes meet the coding requirements for #12048. policyDocumentsMatch removes reserved provider-composed entries from both parsed policy documents before comparison. The removal path can therefo…
Out of Scope Changes check Passed The reviewed changes are limited to policy comparison and its regression coverage. The source change supports #12048. The test covers the provider-readback case and the required mismatch case. No unre…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the policy fix and states that preset removal is verified against operator-owned rules, which matches the main change.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR




🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR





  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ericksoa

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-code-quality

github-code-quality Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 1ac92b5 in the fix/12048-policy-rem... branch is 97%. The line coverage in commit 63002cd in the main branch is 96%.

Show a line coverage summary of the most impacted files.
File main 63002cd fix/12048-policy-rem... 1ac92b5 +/-
nemoclaw/src/onboard/config.ts 98% 96% -2%
nemoclaw/src/index.ts 94% 93% -1%
nemoclaw/src/bl...print/runner.ts 95% 95% 0%
nemoclaw/src/bl...ime-identity.ts 97% 97% 0%
nemoclaw/src/bl...t-management.ts 100% 100% 0%
nemoclaw/src/co.../config-show.ts 100% 100% 0%
nemoclaw/src/commands/slash.ts 100% 100% 0%
nemoclaw/src/on...native-route.ts 0% 100% +100%

TypeScript / code-coverage/cli

The overall line coverage in commit 1ac92b5 in the fix/12048-policy-rem... branch is 86%. The line coverage in commit 63002cd in the main branch is 84%.

Show a line coverage summary of the most impacted files.
File main 63002cd fix/12048-policy-rem... 1ac92b5 +/-
src/lib/onboard.ts 62% 47% -15%
src/lib/actions...ess-recovery.ts 65% 78% +13%
src/lib/state/l...diness-lease.ts 66% 82% +16%
src/lib/inferen...ollama/proxy.ts 41% 61% +20%
src/lib/onboard.../application.ts 55% 84% +29%
src/lib/domain/...y/dimensions.ts 0% 71% +71%
src/lib/actions...try/snapshot.ts 0% 73% +73%
src/lib/actions...ry/operation.ts 0% 76% +76%
src/lib/inferen...nvidia/index.ts 0% 85% +85%
src/lib/onboard...ternal-image.ts 0% 91% +91%

Updated October 11, 2026 02:06 UTC

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 1ac92b5. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

Request review only when Require no Advisor blockers is green.

All previous runs

@ericksoa
ericksoa marked this pull request as ready for review October 11, 2026 21:14
@ericksoa

Copy link
Copy Markdown
Member Author

Maintainer approval recorded for head 1ac92b5: Aaron explicitly approved and requested merge.

All effective CI checks and CodeRabbit pass. The exact-head Docker/Podman E2E comparison satisfies the agreed do-no-harm rule; the evidence is in the PR description. No source changes followed verification.

GitHub prohibits author self-approval for this NVIDIA-owned replay, so this records the approval before the authorized admin squash merge. Cestercian's credit is retained in the merge commit.

@ericksoa
ericksoa merged commit 82526e9 into main Oct 12, 2026
@ericksoa
ericksoa deleted the fix/12048-policy-remove-verification branch October 12, 2026 13:56
@wscurran wscurran added area: policy Network policy, egress rules, presets, or sandbox policy area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression labels Oct 13, 2026
deepujain added a commit that referenced this pull request Oct 30, 2026
…13662)

## Outcome

Removing the Tavily preset detaches this sandbox's Tavily providers and
verifies that effective policy denies search and extraction requests
before reporting success. Shared credentials, other sandboxes, and
unrelated operator rules are preserved. Deep Agents onboarding
qualification can run without a Tavily key; only its authenticated
Tavily check skips, with the reason retained in the uploaded artifacts.

## Reason

The preset and provider profile can independently authorize
`api.tavily.com`. Removing preset keys alone can leave authenticated
requests allowed. Credential replacement also needs an explicit Tavily
attachment on the sandbox's recorded gateway.

In E2E run
[40144054918](https://github.com/NVIDIA/NemoClaw/actions/runs/40144054918/job/121022177417),
requiring Tavily skipped the target before onboarding because the
workflow withheld that key. The required configuration-export evidence
was never written. NVIDIA inference remains required; optional Tavily
qualification follows the existing credential trust rules.

### Related issues

Fixes #13082. Preserves the managed Python and operator-rule behavior
from #6134 and #12983.

## Changes

- Save disabled web-search intent before detaching both Tavily provider
profiles. Verify sandbox identity, attachment readback, and effective
denial. Preserve shared registrations and unrelated rules; report
incomplete removal when verification fails.
- Carry the saved selection through creation and rebuild so a removed
provider is not inherited again. Give Tavily credential replacement an
explicit attachment path on the recorded gateway. Other provider types
retain rebuild guidance, including partial-reset and
unavailable-metadata cases.
- Keep authenticated Tavily coverage in the existing Deep Agents target.
With a key, require HTTP 200 before removal and a fresh `DENIED` audit
event for the managed Python probe's PID and `api.tavily.com:443`
afterward. The real key stays on the host and gateway; sandbox Python
sends a placeholder rewritten at egress.
- Without a Tavily key, skip only `09-deepagents-code-tavily-opt-in.sh`
and retain its status and reason under the uploaded `actions/`
artifacts. Continue the other checks and required configuration export.
Remove the obsolete planner rejection for required Tavily credentials.
Credential exposure rules, authenticated failure checks, and live
assertions remain unchanged.
- Clean up only the preset applied by this invocation, remove its
disposable provider, and restore the prior audit setting. Earlier setup
failures preserve existing policy. Document attachment, gateway lookup,
and rebuild behavior.

## Verification

- The same focused regression selection produced 7 failures and 8 passes
with the runner and registry from
`5604f905b554cded1fdb63527560facc787dffb8`, then 15 passes with the
repair. It covers absent and empty Tavily keys, required inference
metadata, command selection, retained skip reasons, credential
isolation, authenticated failures, and workflow trust cases.
- `node_modules/.bin/vitest run
test/e2e/support/platform-parity-cloud-experimental.test.ts
test/e2e/support/trusted-target-routing-workflow-boundary.test.ts
test/e2e/support/workflow-plan.test.ts
test/e2e/support/workflow-plan-launchable.test.ts
test/automation/pull-requests/growth-guardrails.test.ts --maxWorkers=1
--fileParallelism=false`: 249 passed with a test-local temporary
directory.
- `npm run e2e:assertions:check`: passed, with 1267 direct assertions
across 77 live files. No live assertions or assertion-budget entries
changed.
- The installed pre-commit, commit-msg, and pre-push hooks passed,
including publication validation and the CLI TypeScript check.
- Oxfmt and `git diff --check` passed. The diff contains no secrets, API
keys, or credentials.
- Historical runtime tests at
`8f79ad435e38c397e3ce1ffc716aeced8e395bc2`: 107 credential adapter,
reset-outcome, and compiled-command cases passed. Those tests produced
14 failures and 93 passes against the earlier reset implementation.
Credential runtime code is unchanged by the subsequent qualification
repairs.
- Historical `npm run docs` at
`526827f8dda013aa95503dc8cff27ae5c02a027f`: 125 published pages, zero
errors, and two Fern warnings. Rendered Deep Agents procedures and
OpenClaw/Hermes variants were inspected. The later repairs do not change
`docs/**`, navigation, or redirects.

Hosted evaluation of latest PR commit
`6ae77cedbe2acc1192368517128d04da14d8980e` is pending. Authenticated
Linux x86_64 Tavily enforcement and audit qualification remain
unverified for this commit. WSL ARM qualification is manual because this
scenario has no supported selector.

## Review notes

Decision: Accept sandbox-scoped Tavily revocation with conservative
remaining-access verification. Reason: preset absence must agree with
effective denial while preserving unrelated grants. Placement: the
existing policy lifecycle and OpenShell attachment operations.
Accountable maintainer: @deepujain. Validation plan: focused identity,
partial-write, preserved-rule, production-wiring and rebuild
regressions, followed by authenticated Linux x86_64 and manual WSL ARM
qualification.

A different binary path alone does not prove denial. OpenShell can
authorize process ancestors or relax binary matching through trusted
runtime configuration. Verification therefore retains possible grants
when policy evidence is inconclusive, including audit mode, TLS
passthrough, other protocols, and unsupported glob syntax.

The nine [Advisor specialist
reviews](https://github.com/NVIDIA/NemoClaw/actions/runs/40142367137)
cleared `5604f905b554cded1fdb63527560facc787dffb8`. Self-review and the
documentation writing review of latest PR commit
`6ae77cedbe2acc1192368517128d04da14d8980e` found no additional blocker
in this repair. Fresh independent automated review is pending. Sensitive
policy, credential, onboarding, workflow, and E2E paths still require
human review. DGX Station host-setup evidence is not applicable.

---
Signed-off-by: Deepak Jain <[email protected]>

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

## Summary by CodeRabbit

* **New Features**
* Tavily egress can be explicitly attached to individual sandboxes and
must be reattached after a rebuild if needed.
* Removing the Tavily policy preset detaches Tavily providers and
verifies that access is revoked, while preserving shared gateway
credentials.
* Builds attach Tavily providers only when Tavily is enabled in the
saved web-search selection.
* Cloud E2E checks include an optional Tavily connectivity check when a
key is available; otherwise, that check is skipped.

* **Documentation**
* Updated Tavily setup, credential management, troubleshooting, and
rebuild guidance to explain attachment, access removal, and credential
replacement.
* Clarified that resetting a credential removes it from the gateway;
next steps depend on the provider type.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Deepak Jain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: policy Network policy, egress rules, presets, or sandbox policy area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ubuntu 24.04][CLI&UX][Regression] policy remove exits nonzero after successfully removing a preset

2 participants