Skip to content

refactor: drop the retired redaction remediation from the policy plugin - #113961

Merged
steipete merged 1 commit into
mainfrom
refactor/policy-drop-redact-remediation
Jul 26, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/policy-drop-redact-remediation

Conversation

@steipete

@steipete steipete commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The policy plugin carried an automatic doctor repair for
dataHandling.sensitiveLogging.requireRedaction that wrote logging.redactSensitive. That
key is retired: it is absent from the root schema, listed in dead-config-keys.test.ts, and
stripped by an existing doctor migration. Since the root config object is strict, the repair
would have written a config the Gateway refuses to load, and its advertised configTargets
pointed operators at the same dead key.

Worth stating plainly for reviewers judging risk: the repair is currently unreachable. The
redaction evidence is hardcoded to value: true in policy-state-data.ts, and the finding
builder filters on value !== true, so the finding that would trigger the repair can never
fire. git log -L traces that to PR #111527 (config-surface reduction tranche 3), which
flipped the evidence to an invariant but left the repair, the config target, and the docs
behind. This is leftover debris from that change rather than a live defect.

Why This Change Was Made

Redaction is unconditional now. resolveConfigRedaction() hardcodes tools-mode and reads
only redactPatterns, so config can never yield an "off" state. A remediation whose entire
job was to turn redaction on has nothing left to do, which makes removal the right answer
rather than retargeting it at some other key.

The check and the dataHandling.sensitiveLogging.requireRedaction policy key are kept. That
key is a public policy.jsonc contract still validated by data-auth-shapes.ts, so
retiring it would be a contract change rather than debris removal.

The metadata entry moves from automatic to validateOnly, which is the previously unused
member of that enum and describes this case exactly.

User Impact

No user-visible behavior change, since the repair could not fire. Operators no longer see a
policy that advertises a config fix targeting a key the schema rejects, and
docs/cli/policy.md no longer documents a --fix behavior that does not exist.

One thing reviewers should decide separately: because the evidence is now a hardcoded
invariant, policy/data-handling-redaction-disabled can never produce a finding at all.
Deleting the check outright would be the leaner end state, but that retires a documented
public check id and stops evaluating a public policy key. That reads as a product decision,
so this PR leaves the check reporting-capable and flags it rather than deciding unilaterally.

Evidence

  • node scripts/run-vitest.mjs extensions/policy - 10 files, 363 tests passing.
  • node scripts/run-vitest.mjs src/logging/redact - 148 tests passing.
  • run-tsgo.mjs clean on tsconfig.extensions.json and the extensions test tsconfig.
  • oxfmt --check clean on all six changed TypeScript files; run-oxlint.mjs exit 0 for both
    the extensions and core tsconfigs.
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean, no accepted or actionable findings.

Sibling check: no other remediation in the repo writes a retired key. The logging.redact_off
security audit finding was already removed from production, with a test asserting it is never
emitted. scripts/lib/policy-config-coverage.jsonc still lists the key, but that is a
report-only maintainer inventory that legitimately supports non-schema paths and already
reports pre-existing drift on an unrelated entry, so it is left alone as a different class.

A stale comment in src/logging/redact.ts that explained behavior "regardless of
logging.redactSensitive" now describes the real contract.

LOC delta: +21 / -52 across 7 files, production code net -38.

Sensitive log redaction became unconditional and `logging.redactSensitive`
was retired from the config schema, but the policy doctor still classified
`dataHandling.sensitiveLogging.requireRedaction` as an automatic repair that
would have written the retired key back into config.

Remove the automatic repair (check-id registration, patch branch, and the
`enableSensitiveLoggingRedaction` writer), drop the `logging.redactSensitive`
config target, and reclassify the check as `validateOnly`. The check keeps
evaluating the policy declaration against the redaction invariant; it just no
longer claims a fixable config target. Refresh the policy docs, the finding
fix hint, and a stale comment in `src/logging/redact.ts`.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: policy size: S maintainer Maintainer-authored PR labels Jul 26, 2026
@steipete
steipete marked this pull request as ready for review July 26, 2026 01:16
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 26, 2026
@clawsweeper

clawsweeper Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 25, 2026, 9:21 PM ET / July 26, 2026, 01:21 UTC.

ClawSweeper review

What this changes

This PR removes the policy plugin’s obsolete automatic repair for sensitive-log redaction, changes the related policy check to validation-only, and updates the operator documentation and guidance to reflect that redaction is always enabled.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep this PR open for normal human review: it is a focused cleanup of policy-doctor metadata and a retired config repair, but the protected maintainer label requires explicit maintainer handling. The supplied diff appears internally coherent and introduces no discrete correctness finding; it still needs contributor-visible after-fix behavior proof beyond reported test runs.

Priority: P3
Reviewed head: 0fb65f19564353a401f0bd2256f9c649c19c9187

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is small and coherent from the supplied diff, but the external-PR merge gate lacks directly inspectable real behavior evidence.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused tests and static checks, but does not provide inspectable after-fix real behavior proof such as a redacted Doctor/policy CLI run, live output, or runtime log. Please redact private values; after adding proof, update the PR body for a fresh review or ask a maintainer to comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests and static checks, but does not provide inspectable after-fix real behavior proof such as a redacted Doctor/policy CLI run, live output, or runtime log. Please redact private values; after adding proof, update the PR body for a fresh review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed 4 items Focused branch change: The proposed commit removes the redaction check from the automatic-repair registry and deletes its writer for logging.redactSensitive, while retaining the check and marking its metadata validateOnly.
Operator guidance follows the new behavior: The branch changes the policy documentation from a logging.redactSensitive repair instruction to an always-satisfied sensitive-redaction requirement.
Relevant predecessor: The PR body and related-item context identify the merged config-surface reduction PR as the change that retired the config key; that predecessor merged on 2026-07-22 and is the relevant provenance for this cleanup.
Findings None None.
Security None None.

How this fits together

OpenClaw’s policy plugin compares policy.jsonc requirements with runtime configuration and turns fixable mismatches into Doctor repairs. The affected check concerns sensitive-log redaction and feeds policy findings, repair metadata, CLI guidance, and operator documentation.

flowchart LR
  P[Policy document] --> E[Policy doctor evaluation]
  R[Effective redaction behavior] --> E
  E --> F[Policy finding]
  F --> M[Fix metadata]
  M --> D[Doctor repair or validation guidance]
  D --> O[Operator CLI and docs]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests and static checks, but does not provide inspectable after-fix real behavior proof such as a redacted Doctor/policy CLI run, live output, or runtime log. Please redact private values; after adding proof, update the PR body for a fresh review or ask a maintainer to comment @clawsweeper re-review.
  • Resolve merge risk (P1) - This changes a Doctor repair classification and removes its advertised configuration target; maintainers should confirm the current runtime invariant and policy-check contract before merging so no supported operator repair path is silently retired.
  • Complete next step (P2) - The protected maintainer label and compatibility-sensitive Doctor contract require an explicit maintainer review; the contributor can materially improve the merge record with a redacted real after-fix evaluation.
Agent review details

Security

None.

PR surface

Source -29, Tests -2, Docs 0. Total -31 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 10 39 -29
Tests 1 5 7 -2
Docs 1 6 6 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 21 52 -31

Review metrics

Metric Value Why it matters
Doctor remediation surface 1 automatic remediation removed; 1 policy check reclassified to validation-only The diff changes an operator-facing repair contract while retaining the public check identifier.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/policy/src/doctor/automatic-repairs.ts, migration/backfill/repair: extensions/policy/src/doctor/data-auth-findings.ts, migration/backfill/repair: extensions/policy/src/doctor/scopes/data-auth.ts, vector/embedding metadata: extensions/policy/src/doctor/metadata.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm the retired repair is unreachable (recommended)
    Before merge, capture a redacted real Doctor or policy evaluation showing that the retained check exposes validation guidance only and never proposes logging.redactSensitive.
  2. Pause for policy-contract review
    Hold this PR if maintainers want to retire the documented policy check itself rather than preserve it as a validation-only compatibility contract.

Technical review

Best possible solution:

Keep the public policy check identifier, remove only the impossible config write, and land after a redacted after-fix Doctor/policy evaluation demonstrates that the check remains validation-only without advertising the retired key.

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

No high-confidence live reproduction was supplied. The branch describes a source-level path in which a retained policy repair would target a retired strict-schema key, but the claimed unreachable condition needs direct runtime confirmation.

Is this the best way to solve the issue?

Yes, conditionally: deleting a repair that cannot produce a valid current configuration is narrower and safer than retargeting it. Retaining the documented policy check as validation-only is the conservative contract-preserving choice unless maintainers separately decide to retire that check.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4596fd2dd2c6.

Labels

Label changes:

  • add P3: This is a small cleanup of unreachable policy-doctor remediation rather than an active user-facing incident.
  • add merge-risk: 🚨 compatibility: Removing a Doctor repair and its configuration target can alter upgrade-time operator guidance even when the branch asserts the old path is unreachable.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and static checks, but does not provide inspectable after-fix real behavior proof such as a redacted Doctor/policy CLI run, live output, or runtime log. Please redact private values; after adding proof, update the PR body for a fresh review or ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P3: This is a small cleanup of unreachable policy-doctor remediation rather than an active user-facing incident.
  • merge-risk: 🚨 compatibility: Removing a Doctor repair and its configuration target can alter upgrade-time operator guidance even when the branch asserts the old path is unreachable.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and static checks, but does not provide inspectable after-fix real behavior proof such as a redacted Doctor/policy CLI run, live output, or runtime log. Please redact private values; after adding proof, update the PR body for a fresh review or ask a maintainer to comment @clawsweeper re-review.

Evidence

What I checked:

  • Focused branch change: The proposed commit removes the redaction check from the automatic-repair registry and deletes its writer for logging.redactSensitive, while retaining the check and marking its metadata validateOnly. (extensions/policy/src/doctor/automatic-repairs.ts:25, 0fb65f195643)
  • Operator guidance follows the new behavior: The branch changes the policy documentation from a logging.redactSensitive repair instruction to an always-satisfied sensitive-redaction requirement. Public docs: docs/cli/policy.md. (docs/cli/policy.md:411, 0fb65f195643)
  • Relevant predecessor: The PR body and related-item context identify the merged config-surface reduction PR as the change that retired the config key; that predecessor merged on 2026-07-22 and is the relevant provenance for this cleanup. (extensions/policy/src/doctor/fix-metadata.ts:327, edecdbd05efc)
  • CI and supplied validation: The supplied PR context reports passing repository checks and focused policy/redaction test runs, but it does not include an inspectable real after-fix Doctor run, terminal capture, or redacted runtime log. (0fb65f195643)

Likely related people:

  • steipete: Authored the proposed cleanup and the merged config-surface reduction work that the PR identifies as retiring the affected config key. (role: config-contract contributor; confidence: medium; commits: 0fb65f195643, edecdbd05efc; files: extensions/policy/src/doctor/automatic-repairs.ts, extensions/policy/src/doctor/fix-metadata.ts, docs/cli/policy.md)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted terminal capture or live output showing the retained policy check is validation-only and no longer proposes the retired config key.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 977c8e9 into main Jul 26, 2026
238 of 249 checks passed
@steipete
steipete deleted the refactor/policy-drop-redact-remediation branch July 26, 2026 01:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 26, 2026
…enclaw#113961)

Sensitive log redaction became unconditional and `logging.redactSensitive`
was retired from the config schema, but the policy doctor still classified
`dataHandling.sensitiveLogging.requireRedaction` as an automatic repair that
would have written the retired key back into config.

Remove the automatic repair (check-id registration, patch branch, and the
`enableSensitiveLoggingRedaction` writer), drop the `logging.redactSensitive`
config target, and reclassify the check as `validateOnly`. The check keeps
evaluating the policy declaration against the redaction invariant; it just no
longer claims a fixable config target. Refresh the policy docs, the finding
fix hint, and a stale comment in `src/logging/redact.ts`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: policy maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant