Skip to content

policy: preview review-required gateway repairs#99776

Merged
giodl73-repo merged 5 commits into
openclaw:mainfrom
giodl73-repo:policy-doctor-review-required-previews
Jul 8, 2026
Merged

policy: preview review-required gateway repairs#99776
giodl73-repo merged 5 commits into
openclaw:mainfrom
giodl73-repo:policy-doctor-review-required-previews

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restacked on current main after policy: repair denied gateway http endpoints #99731 merged.
  • Adds review-required doctor --fix previews for Gateway policy findings that should not be auto-mutated:
    • policy/gateway-non-loopback-bind: previews setting gateway.bind=loopback for gateway.bind and gateway.customBindHost non-loopback findings.
    • policy/gateway-node-command-denied: previews appending the missing command to gateway.nodes.denyCommands.
  • Preserves skipped repair preview changes in the structured repair flow so review-required guidance is visible without counting the check as repaired.
  • Documents the Gateway review-required preview behavior in docs/cli/policy.md; no generic Doctor docs were changed.

Real behavior proof

Behavior or issue addressed:
doctor --fix source repair flow now surfaces review-required preview guidance for Gateway bind and Gateway node-command policy findings without mutating config or counting the check as repaired.

Real environment tested:
WSL Ubuntu source checkout at PR head ebd6b1248e574dfaa72bbf30b31ba1c24a09c7b7, rebased on current main. The proof used the real Policy doctor registration plus runDoctorHealthRepairs against an isolated temp workspace with plugins.entries.policy.config.workspaceRepairs=true; no live Gateway server, provider, network call, or LLM call was started.

Exact steps or command run after this patch:

  1. Seed isolated openclaw.jsonc and in-memory config with gateway.bind="lan" and gateway.nodes.denyCommands=["mcp.help"].
  2. Seed isolated policy.jsonc with gateway.exposure.allowNonLoopbackBind=false and gateway.nodes.denyCommands=["mcp.help","system.run"].
  3. Register the real Policy doctor checks with registerPolicyDoctorChecks and run runDoctorHealthRepairs for policy/gateway-non-loopback-bind and policy/gateway-node-command-denied.
  4. Confirm skipped preview changes are emitted, checksRepaired stays zero, and the resulting Gateway config plus config file remain unchanged.
  5. Run focused validation: node scripts/run-vitest.mjs extensions/policy/src/doctor/register.test.ts src/flows/doctor-repair-flow.test.ts --reporter=dot.

Evidence after fix:

HEAD=ebd6b1248e574dfaa72bbf30b31ba1c24a09c7b7
WORKSPACE=/tmp/policy-gateway-preview-proof-aXzpAV
CHECKS_RUN=2
CHECKS_REPAIRED=0
CHECKS_VALIDATED=0
FINDINGS=[{"checkId":"policy/gateway-non-loopback-bind","ocPath":"oc://openclaw.config/gateway/bind","message":"Gateway bind setting 'gateway-bind' permits non-loopback exposure."},{"checkId":"policy/gateway-node-command-denied","ocPath":"oc://openclaw.config/gateway/nodes/denyCommands","message":"Gateway node command 'system.run' is denied by policy but not denied by OpenClaw config."}]
CHANGES=["Review required: set gateway.bind=loopback for policy conformance.","Review required: add system.run to gateway.nodes.denyCommands for policy conformance."]
WARNINGS=["Review required: set gateway.bind=loopback for policy conformance.","policy/gateway-non-loopback-bind repair skipped: policy repair requires review before changing config","Review required: add system.run to gateway.nodes.denyCommands for policy conformance.","policy/gateway-node-command-denied repair skipped: policy repair requires review before changing config"]
EFFECTS=[{"kind":"config","action":"would-set-after-review","target":"gateway.bind=loopback","dryRunSafe":true},{"kind":"config","action":"would-append-after-review","target":"gateway.nodes.denyCommands += system.run","dryRunSafe":true}]
CONFIG_UNCHANGED=true
AFTER_GATEWAY={"bind":"lan","nodes":{"denyCommands":["mcp.help"]}}
CONFIG_FILE={}

Supporting validation:

[test] passed 2 Vitest shards in 18.34s
Test Files: 2 passed
Tests: 308 passed

Observed result after fix:
The repair flow detected both review-required Gateway findings, reported both skipped preview changes, preserved checksRepaired=0, and left both the effective Gateway config and the config file unchanged. Operators see the proposed gateway.bind and gateway.nodes.denyCommands changes as review guidance only.

What was not tested:
No packaged CLI invocation, live Gateway server, provider, network call, or LLM call was run. This proof exercises the real source-entry doctor registration and repair runner, not a packaged install.

Stack

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts extensions: policy size: XL maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head defc304de20cf615cd66b5904cee8c48b22fd3c3, but the PR head is now 5a76487a31e25a98caa8c0012bc3c1b9cb4d203c. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-07T22:22:31.938Z sha c4395e6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-07T22:30:52.585Z sha c4395e6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T00:02:44.797Z sha cd718e1 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T16:59:29.241Z sha cd718e1 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T17:07:35.948Z sha cd718e1 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T17:16:22.092Z sha ebd6b12 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T17:23:26.315Z sha ebd6b12 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T17:31:33.735Z sha defc304 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 4, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I restacked the policy series onto current upstream/main with non-force merge commits, resolved the test/scripts/plugin-sdk-surface-report.test.ts conflict, and added the exact Real behavior proof section to this PR body.

Fresh proof from the top of the stack (283c1bb4ca):

  • node scripts/run-vitest.mjs extensions/policy/src/doctor/metadata.test.ts extensions/policy/src/doctor/register.test.ts extensions/policy/src/doctor/strictness.test.ts src/flows/doctor-repair-flow.test.ts --reporter=dot passed: 10 core repair-flow tests + 297 policy doctor tests.
  • node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts --reporter=dot passed: 7 tests.
  • pnpm tsgo:extensions passed.
  • pnpm lint:extensions passed.
  • git diff --check passed.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@omarshahine

Copy link
Copy Markdown
Contributor

Codex review of the Review-Required Previews PR.

No blocking findings in the incremental diff against the Gateway HTTP PR.

Best-fix verdict: best for this preview-only behavior. Keeping these gateway findings review-required while adding non-mutating preview repair() handlers in extensions/policy/src/doctor/scopes/gateway.ts and extensions/policy/src/doctor/review-required-repairs.ts preserves the policy decision that gateway.bind and gateway.nodes.denyCommands should not be automatically rewritten. Moving skipped split-repair changes collection ahead of the early return in src/flows/doctor-repair-flow.ts:130 is also the right runner-level change so those previews are visible without falsely counting the check as repaired.

Evidence checked: src/flows/doctor-repair-flow.ts, src/flows/doctor-health-contributions.ts, src/flows/health-check-adapter.ts, src/flows/health-checks.ts, extensions/policy/src/doctor/scopes/gateway.ts, extensions/policy/src/policy-state.ts, extensions/policy/src/doctor/register.ts, extensions/policy/src/doctor/fix-metadata.ts, extensions/policy/src/doctor/review-required-repairs.ts, extensions/policy/src/doctor/register.test.ts, and src/flows/doctor-repair-flow.test.ts.

Proof gap: I did not run packaged CLI proof, so exact stdout/stderr rendering from surfacing the preview in both warnings and changes is source-level verified rather than end-to-end exercised.

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Jul 4, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

No blocking findings from Omar on this PR. I propagated the lower-stack review fixes through this branch in 7aebf26a24 so the top-of-stack proof covers the corrected repair behavior.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Reviewer-requested fixes are pushed on this updated head. Fresh local proof before push: focused policy/core/CLI/tooling Vitest passed, pnpm tsgo:extensions passed, pnpm lint:extensions passed, git diff --check passed, and node --import tsx scripts/check-policy-config-coverage.ts --check --json passed.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations and removed commands Command implementations docs Improvements or additions to documentation scripts Repository scripts labels Jul 4, 2026
@giodl73-repo
giodl73-repo requested review from a team as code owners July 8, 2026 17:09
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo app: android App: android app: ios App: ios app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core scripts Repository scripts commands Command implementations labels Jul 8, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Maintainer acceptance for current head ebd6b1248e574dfaa72bbf30b31ba1c24a09c7b7: accept the review-required Gateway preview behavior.

Rationale: policy/gateway-non-loopback-bind and policy/gateway-node-command-denied are security-sensitive Gateway settings, so this PR intentionally keeps them review-required while surfacing non-mutating doctor --fix preview guidance. The current proof shows the repair flow emits skipped preview changes, keeps CHECKS_REPAIRED=0, and leaves Gateway config unchanged. This is the intended operator guidance boundary, not an automatic config mutation.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current head: ebd6b12

Restacked onto current main after merge verification found relevant mainline drift. The PR body has refreshed exact-head source behavior proof: real Policy doctor registration plus runDoctorHealthRepairs on seeded Gateway bind and node-command findings, skipped preview changes emitted, CHECKS_REPAIRED=0, and CONFIG_UNCHANGED=true with config file still {}.

Focused validation on the synced tree passed:

  • node scripts/run-vitest.mjs extensions/policy/src/doctor/register.test.ts src/flows/doctor-repair-flow.test.ts --reporter=dot
  • 2 Vitest shards, 2 files passed, 308 tests passed.

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: ios App: ios app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: qqbot channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo commands Command implementations docs Improvements or additions to documentation extensions: diagnostics-otel Extension: diagnostics-otel extensions: diffs extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-wiki extensions: oc-path extensions: policy extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: file-transfer plugin: google-meet plugin: logbook Logbook automatic work journal plugin scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants