-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(policy): expose active presets, allowed hosts, and approval paths in agent context #4915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8303efb
feat(policy): expose active presets, allowed hosts, and approval path…
laitingsheng 60fe251
fix(policy): address review feedback on policy-explain
laitingsheng 325de98
Merge remote-tracking branch 'origin/main' into feat/4629-policy-agen…
laitingsheng f65c805
test(policy): align hardcoded sandbox action lists with policy-explain
laitingsheng 8d30f57
fix(policy): keep policy-explain seed inert in tests and on no-op cha…
laitingsheng 9f732af
docs(policy): resync agent variant after policy-explain em-dash fix
laitingsheng 86d17ab
fix(policy): tighten policy-explain context and address review-adviso…
laitingsheng b631ea8
Merge remote-tracking branch 'origin/main' into feat/4629-policy-agen…
laitingsheng ad2549c
refactor(policy): split context, harden redaction, distinguish loader…
laitingsheng 741d2da
test(policy): pin channel-refresh contract, broaden link-local redact…
laitingsheng 0893975
fix(policy): shield rebuild from refresh-path exits, harden write aga…
laitingsheng 2122861
Merge remote-tracking branch 'origin/main' into feat/4629-policy-agen…
laitingsheng d899b42
fix(policy): classify block-code drift on matched preset as blocked-b…
laitingsheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { Flags } from "@oclif/core"; | ||
|
|
||
| import { explainSandboxPolicy } from "../../../lib/actions/sandbox/policy-explain"; | ||
| import { NemoClawCommand } from "../../../lib/cli/nemoclaw-oclif-command"; | ||
| import { sandboxNameArg } from "../../../lib/sandbox/command-support"; | ||
|
|
||
| export default class SandboxPolicyExplainCommand extends NemoClawCommand { | ||
| static id = "sandbox:policy:explain"; | ||
| static strict = true; | ||
| static summary = "Explain the active policy context for the sandbox"; | ||
| static description = | ||
| "Print a redacted summary of the active policy presets, allowed host categories, approval paths, and support boundaries. The agent can read this output to decide whether a host or integration is allowed and what remediation step to suggest."; | ||
| static usage = ["<name> [--json] [--write]"]; | ||
| static examples = [ | ||
| "<%= config.bin %> sandbox policy explain alpha", | ||
| "<%= config.bin %> sandbox policy explain alpha --json", | ||
| "<%= config.bin %> sandbox policy explain alpha --write", | ||
| ]; | ||
| static args = { | ||
| sandboxName: sandboxNameArg, | ||
| }; | ||
| static flags = { | ||
| json: Flags.boolean({ | ||
| description: "Emit the policy context as JSON for agent consumption.", | ||
| default: false, | ||
| }), | ||
| write: Flags.boolean({ | ||
| description: | ||
| "Also write the rendered context to the sandbox at /sandbox/.openclaw/workspace/POLICY.md so the in-sandbox agent can read it.", | ||
| default: false, | ||
| }), | ||
| }; | ||
|
|
||
| public async run(): Promise<void> { | ||
| const { args, flags } = await this.parse(SandboxPolicyExplainCommand); | ||
| explainSandboxPolicy( | ||
| args.sandboxName, | ||
| { json: flags.json, writeToSandbox: flags.write }, | ||
| { logJson: (value) => this.logJson(value) }, | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.