Skip to content

feat(console): simplify policy denials and add batch rule review - #3232

Merged
mrunalp merged 2 commits into
openclaw:mainfrom
derekwaynecarr:feat/console-policy-denials
Oct 26, 2026
Merged

mrunalp merged 2 commits into
openclaw:mainfrom
derekwaynecarr:feat/console-policy-denials

Conversation

@derekwaynecarr

@derekwaynecarr derekwaynecarr commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Policy denials tab is crowded, important controls are difficult to discover, and reviewing repeated denials requires unnecessary individual actions.

Change

  • Put Network policy controls and suggestions above the denial log.
  • Move Policy editing beside Manage rules; keep View rules and suggestions available when editing is disabled.
  • Add a separate, read-only View network limits dialog.
  • Show five denials or rules per page, with search and expandable details.
  • Add Allow this and cross-page Allow selected actions. Review groups repeated requests, identifies existing coverage, and preserves saved rules.
  • Simplify rule management with row actions and a contextual footer.
  • Distinguish saved, applying, applied, and unconfirmed states. Refresh status only reads; retry requires a separate explicit action.
  • Update documentation, Storybook scenarios, browser coverage, and CI test registration.

Verification

Tested head: 50427a697, rebased onto upstream/main at 3cf3b8948.

  • 71 focused browser tests passed, with zero failures or skips.
  • pnpm lint, pnpm typecheck, pnpm format:check, and pnpm check:workspace passed.
  • git diff --check passed.
  • Before the final rebase: documentation checks passed, Storybook was rebuilt and visually inspected, and the deployed Compose OCC / Kubernetes compute / OpenShell environment was manually verified with dedicated Codex and a 12-entry Installation ceiling.

Storybook coverage includes Policy Denials Many, Policy Suggestions Expanded, Policy Denials Disabled, Policy Rules Populated, and Policy Retry Application.

Browser tests exercise real controller routes with in-memory storage and test Drivers. Storybook provides simulated UI proof.

Attach final screenshots and the interaction video here before merging.

Risks

Save/apply transitions and permission changes are the main regression risks. Coverage exercises ceiling rejection, stale previews, unconfirmed saves, retained drafts, and explicit retry behavior.
editing-on
editing-off
manage-rules
network-limits

policy-controls-final.webm

@derekwaynecarr
derekwaynecarr requested a review from a team as a code owner October 22, 2026 22:08
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR reorganizes policy controls and adds paginated denial browsing, batch rule review, and searchable rule management.

Example: Select six denials containing repeated requests and one already-saved grant.

  • Before: Each denial requires an individual policy-addition action.
  • After: One batch review proposes two new rules while retaining the saved grant.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful workflow improvement with visual and controller-backed evidence, held by two remaining concrete findings.
Proof confidence 🦐 gold shrimp (3/6) ✨ media proof bonus Sufficient (screenshot): Inspected screenshots demonstrate the changed editing controls, rule pagination, and network-limits dialog; controller-backed browser coverage supports batch admission, while Storybook is explicitly simulated and the linked video could not be inspected because of reviewer infrastructure limits.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Operators must navigate crowded policy controls and repeatedly review equivalent denial requests individually.
Reason: The maintainer-authored direction improves the existing Agent workflow while preserving explicit review, save, and application.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: the maintainer-directed improvement remains useful, but two prior findings still need repair; the stale-preview finding is resolved.

Priority: P2
Reviewed head: 50427a697a77056efde6f89dbcaef01a90c0878c

Before merge

  • Honor saved wildcard grants when checking coverage (P2) - This prior finding remains: with a saved /usr/bin/python3.11 grant for *.example.org:443, selecting a historical denial for api.example.org:443 fails this exact-host comparison and appends another rule. Batch review incorrectly reports new access, and redundant entries can exceed the 32-grant limit and reject an otherwise admissible batch. Match the contract's single-label wildcard semantics when identifying covered requests.
  • Preserve malformed JSON edits when returning to rules (P3) - This prior finding also remains: in a schema-backed JSON fallback field, enter an unfinished value such as "service.example.org without its closing quote, then choose Back to rules and reopen the rule. configurationFields keeps malformed text only in the textarea, so renderEditor rebuilds from the last parsed additions and silently loses the edit. Preserve the raw draft, or keep the editor open with a visible validation message until the JSON is corrected.

Findings

  • [P2] Honor saved wildcard grants when checking coverage — apps/controller/src/console/agents/sandbox-policy.mts:145-148
  • [P3] Preserve malformed JSON edits when returning to rules — apps/controller/src/console/agents/sandbox-policy.mts:1455-1457

Tests

  • Missing end-to-end proof: No supplied base-to-head regression run demonstrates wildcard coverage or malformed-JSON retention.
Agent review details

How this fits together

The Agent Console turns denial records and provider suggestions into local proposals, then uses existing controller validation, save, and apply operations; the worker authorizes durable application before invoking the Sandbox Driver.

flowchart LR
  Logs[Sandbox denial records] --> Console[Agent Console]
  Suggestions[Provider suggestions] --> Console
  Console --> Review[Local proposal and review]
  Review --> Controller[Controller admission and IAM]
  Controller --> Storage[Saved policy and durable work]
  Storage --> Worker[Worker authorization]
  Worker --> Sandbox[Sandbox Driver]
Loading

Technical review

Best possible solution:

Align batch coverage with supported wildcard semantics and prevent Back to rules from discarding malformed JSON while retaining the existing preview guards.

Do we have a high-confidence way to reproduce the issue?

Current source establishes both remaining triggers: wildcard hosts fail exact equality, and rebuilding the editor drops malformed textarea content that never reached onChange; no target code was run.

Is this the best way to solve the issue?

The existing Console and controller owners are appropriate, and the remaining fixes can stay local without changing authorization, storage, or Driver contracts.

Full review comments:

  • [P2] Honor saved wildcard grants when checking coverage — apps/controller/src/console/agents/sandbox-policy.mts:145-148
    This prior finding remains: with a saved /usr/bin/python3.11 grant for *.example.org:443, selecting a historical denial for api.example.org:443 fails this exact-host comparison and appends another rule. Batch review incorrectly reports new access, and redundant entries can exceed the 32-grant limit and reject an otherwise admissible batch. Match the contract's single-label wildcard semantics when identifying covered requests.
    Confidence: 0.99
  • [P3] Preserve malformed JSON edits when returning to rules — apps/controller/src/console/agents/sandbox-policy.mts:1455-1457
    This prior finding also remains: in a schema-backed JSON fallback field, enter an unfinished value such as "service.example.org without its closing quote, then choose Back to rules and reopen the rule. configurationFields keeps malformed text only in the textarea, so renderEditor rebuilds from the last parsed additions and silently loses the edit. Preserve the raw draft, or keep the editor open with a visible validation message until the JSON is corrected.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7f338874d204.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node --test tests/browser/console-policy-denials.test.ts
  • node --test tests/browser/console-agent-draft-guards.test.mjs tests/browser/console-agent-save-refusals.test.ts
  • pnpm lint
  • pnpm format:check
  • pnpm check:workspace

What I checked:

Likely related people:

  • Derek Carr: Raw commit 1415152 adds docs/reference/sandbox-policies.md:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 141515257737; files: docs/reference/sandbox-policies.md)
  • Free Wortley: Raw commit c8f73c8 adds apps/controller/src/console/agents/sandbox-policy.mts:51 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c8f73c8b1d7a; files: apps/controller/src/console/agents/sandbox-policy.mts)
  • Kevin: Raw commit 774b3d6 adds docs/reference/sandbox-policies.md:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 774b3d6760f9; files: docs/reference/sandbox-policies.md)

Review metrics

Metric Value Why it matters
Production and browser-test changes Production +2,198/−336 lines; browser tests +441/−62 lines Production growth stays in the existing Console owner and stylesheet; browser additions exercise batch workflow and admission rather than adding backend machinery.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: The improvement reduces operator friction, while the remaining defects affect proposal accuracy and draft retention with limited scope.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-22T22:23:42.645Z sha 7fbf33b :: needs changes before merge. :: [P2] Invalidate previews when replacing the editor | [P2] Honor saved wildcard grants when checking coverage | [P3] Preserve malformed JSON edits when returning to rules

Reviewed October 26, 2026, 2:16 PM ET / 18:16 UTC (Revision 2).

@freeqaz

freeqaz commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Free's clanker here (an AI agent working on Free's behalf). CI hasn't started on this PR because GitHub can't build the merge with main: head 7fbf33b conflicts in apps/controller/src/console/agents/sandbox-policy.mts and scripts/console-storybook/public/fixtures.mjs. Main changed both files in the Credential Proxy merge (#2487, 3115679) since this branch's base. Once main is merged in, the full CI matrix should start on its own.

@derekwaynecarr
derekwaynecarr force-pushed the feat/console-policy-denials branch from a857540 to 50427a6 Compare October 26, 2026 16:53
@derekwaynecarr
derekwaynecarr marked this pull request as ready for review October 26, 2026 16:58
@mrunalp

mrunalp commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

1 similar comment
@derekwaynecarr

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper clawsweeper Bot added the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Oct 26, 2026
@mrunalp
mrunalp merged commit eda1f15 into openclaw:main Oct 26, 2026
63 checks passed
freeqaz added a commit that referenced this pull request Oct 26, 2026
…ngle-rule prefill (#3783)

Follows up #3232. The batch review's 'How the selection becomes rules' line now formats each grant with grantText, so the Sandbox-log host is shown through visibleText like everywhere else. Tests: negative assertions use the controls' current names; a new test covers 'Allow this' on a second port of an allowed host and 'Review suggestion' on an already-covered suggestion; the batch test checks that Refresh denials clears the selection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants