Exec approvals: unify effective policy reporting and actions#59283
Conversation
Greptile SummaryThis PR aligns exec approval UX with the host-effective ask policy by propagating Key changes:
Issues found:
Confidence Score: 4/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/infra/exec-approvals-effective.ts
Line: 110-115
Comment:
**Redundant wrapper function**
`formatHostSource` is a pass-through to `resolveHostFieldSource` with no added formatting logic. All three call sites could invoke `resolveHostFieldSource` directly, removing this layer of indirection.
```suggestion
```
Replace all three `formatHostSource(...)` calls with `resolveHostFieldSource(...)` and remove this function entirely.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/gateway/server-methods/exec-approval.ts
Line: 328-344
Comment:
**Server-side `allow-always` guard only runs when snapshot is present**
The `isExecApprovalDecisionAllowed` check is wrapped in `if (snapshot && ...)`. When `snapshot` is `null` (i.e., the approval ID isn't found), the guard is skipped and `manager.resolve` is called with an unknown ID, which will return `false`. The overall outcome is the same — the resolve fails — but an `allow-always` attempt on a missing ID won't produce the specific policy-rejection error. This is a pre-existing limitation of the ID-not-found path, but worth noting in case a distinct error response is expected for stale IDs with disallowed decisions.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "exec: align approval UX with host policy" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR aligns exec-approval UX (reply text/buttons, forwarded fallback text, /approve parsing guidance) with the effective ask policy, and adds shared effective-policy reporting for openclaw approvals get and doctor.
Changes:
- Add
resolveExecApprovalAllowedDecisions()and thread allowed decisions through exec approval messaging, buttons, and validation (hiding “allow always” when ask=always). - Introduce shared effective-policy summarization (
resolveExecPolicyScopeSummary) and surface it inopenclaw approvals get+doctor(including correct wildcardagents.*source attribution). - Update
/approveusage text, agent system prompt guidance, and docs to match runtime behavior.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugin-sdk/approval-runtime.ts | Re-export allowed-decision helper for plugin/extension consumers. |
| src/infra/exec-approvals.ts | Add allowed-decision resolution + decision-allowed predicate for runtime validation. |
| src/infra/exec-approvals-policy.test.ts | Add tests covering effective-policy explanation and wildcard attribution. |
| src/infra/exec-approvals-effective.ts | New shared “requested/host/effective” exec policy summarization utilities. |
| src/infra/exec-approval-reply.ts | Render pending approval replies/buttons based on allowed decisions; adjust copy. |
| src/infra/exec-approval-reply.test.ts | Verify “allow always” is omitted when ask=always. |
| src/infra/exec-approval-forwarder.ts | Forwarded fallback text now reflects allowed decisions and updated background-mode note. |
| src/infra/exec-approval-forwarder.test.ts | Test forwarded text excludes allow-always when ask=always. |
| src/gateway/server-methods/server-methods.test.ts | Add handler test ensuring allow-always is rejected when ask=always. |
| src/gateway/server-methods/exec-approval.ts | Enforce decision availability server-side via isExecApprovalDecisionAllowed. |
| src/commands/doctor-security.ts | Switch to shared effective-policy summary for conflict warnings. |
| src/commands/doctor-security.test.ts | Ensure wildcard agent policy sources appear in warnings. |
| src/cli/exec-approvals-cli.ts | Add effective-policy reporting to approvals get (table + JSON). |
| src/cli/exec-approvals-cli.test.ts | Update mocks/assertions for config fetching + effectivePolicy JSON output. |
| src/auto-reply/reply/commands-approve.ts | Update /approve usage text to avoid hard-coded decision list. |
| src/agents/system-prompt.ts | Remove hard-coded decision list from exec approval guidance. |
| src/agents/system-prompt.test.ts | Assert prompt no longer includes `allow-once |
| src/agents/pi-embedded-subscribe.handlers.tools.ts | Preserve/validate allowedDecisions from tool details into reply payload. |
| src/agents/pi-embedded-subscribe.handlers.tools.test.ts | Test filtered allowed decisions are preserved (no allow-always). |
| src/agents/bash-tools.exec.approval-id.test.ts | Update expectations to support dynamic decision lists and new notes. |
| src/agents/bash-tools.exec-types.ts | Extend exec tool details to optionally include allowedDecisions. |
| src/agents/bash-tools.exec-runtime.ts | Render pending approval message based on allowed decisions; adjust background note. |
| src/agents/bash-tools.exec-host-shared.ts | Include allowedDecisions in pending tool result/details. |
| src/agents/bash-tools.exec-host-node.ts | Populate allowedDecisions from effective ask on node host. |
| src/agents/bash-tools.exec-host-gateway.ts | Populate allowedDecisions from effective ask on gateway host. |
| extensions/telegram/src/exec-approvals-handler.ts | Hide allow-always actions in Telegram approvals when ask=always. |
| extensions/telegram/src/exec-approvals-handler.test.ts | Test Telegram UI omits allow-always when ask=always. |
| extensions/telegram/src/exec-approval-forwarding.ts | Include allowedDecisions when building Telegram pending payload. |
| docs/tools/slash-commands.md | Update /approve docs to reference “see pending message for decisions”. |
| docs/tools/exec-approvals.md | Document using openclaw approvals get to inspect effective policy. |
| docs/cli/approvals.md | Document new effective-policy section and precedence rules in CLI output. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6a4e4ea3c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9813a72 to
dc25bff
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e53db04284
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 047567a871
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ac3113e03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8f28af4 to
d579b97
Compare
|
Merged via squash.
Thanks @gumadeiras! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d579b97a93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…w#59283) Merged via squash. Prepared head SHA: d579b97 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
…w#59283) Merged via squash. Prepared head SHA: d579b97 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
…w#59283) Merged via squash. Prepared head SHA: d579b97 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
…w#59283) Merged via squash. Prepared head SHA: d579b97 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
…w#59283) Merged via squash. Prepared head SHA: d579b97 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Summary
openclaw approvals getreport real runtime-effective policy, including combined node host approvals + gatewaytools.execwhen gateway config is available/approve, reply payloads, Discord, Slack, and Telegramtools.exec,askFallbackattribution, wildcard/default-agent scopes, and config-unavailable fallback handlingTesting