Skip to content

refactor: delete the unreachable redaction policy check - #113993

Merged
steipete merged 1 commit into
mainfrom
refactor/policy-delete-unreachable-redaction-check
Jul 26, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/policy-delete-unreachable-redaction-check

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

policy/data-handling-redaction-disabled cannot fire. scanPolicyDataHandling pushes the
sensitiveLoggingRedaction evidence with a literal value: true, and the finding builder
filters on entry.value !== true, so the check evaluates on every run and can never produce a
finding. Redaction is unconditional: resolveConfigRedaction() hardcodes the mode and reads
only redactPatterns.

This is the remainder of the cleanup started in #113961, which removed the check's automatic
repair and flagged the check itself as a follow-up.

Why This Change Was Made

A check that structurally cannot report is dead weight, and leaving it registered implies the
requirement is being actively evaluated when it is not.

Two things that looked removable turned out not to be, and shaped the result:

  • The evidence entry is load-bearing. openclaw policy check emits it, and
    policyWorkspaceHash computes sha256(stableJson(evidence)) for the attestation. Deleting
    it would change every operator's attestation hash, making openclaw policy watch report
    stale until they re-accept, while removing the only visible proof the requirement is met.
  • The policy rule metadata is load-bearing. It drives openclaw policy compare, so the
    key still enforces baseline strictness between a baseline and a candidate policy.

So the public dataHandling.sensitiveLogging.requireRedaction key is deliberately kept. It is
a policy.jsonc contract still validated by data-auth-shapes.ts; retiring it would reject
existing operator policy files.

That leaves the risk that the key becomes silently accepted-but-unenforced. It is made
explicit instead: the rule now declares satisfiedByInvariant: "oc://openclaw.invariant/logging/redaction" alongside checkIds: [], reusing the existing
oc://openclaw.invariant/... convention already used for Control UI device-identity posture.

User Impact

No behavior change. The check could not fire, so no finding disappears, no repair is lost, and
attestation hashes are unchanged.

Operators declaring the key keep everything that actually did something: shape validation,
policy compare baseline strictness, and invariant evidence in both policy check output and
the attestation. docs/cli/policy.md now states that explicitly rather than describing a
check id that no longer exists.

One detail preserved on purpose: dataHandlingPolicyHasRules keeps its requireRedaction
clause, because evaluatePolicy only collects data-handling evidence when the policy declares
data-handling rules. Removing it would make an operator who declares only this key get silence.

Evidence

  • node scripts/run-vitest.mjs extensions/policy - 10 files, 364 tests passing.
  • New metadata test asserts every policy rule names either its checks or an invariant, never
    both and never neither, and that policy state actually emits the declared source. The guard
    was confirmed to bite by temporarily pointing it at a bogus source and observing the failure.
    This also gives checkIds its first real consumer; nothing else in the repo read that field.
  • node scripts/run-tsgo.mjs green for tsconfig.extensions.json, the extensions test
    tsconfig, and tsconfig.scripts.json.
  • oxfmt --check and oxlint clean on every touched file.
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean, no accepted or actionable findings.

Also removed a stale scripts/lib/policy-config-coverage.jsonc entry mapping the retired
logging.redactSensitive config key to this rule; that key is listed in
src/config/dead-config-keys.test.ts.

Pre-existing and untouched: pnpm policy:config-coverage reported ok: false before and after
this change, from an unrelated stale gateway.controlUi.allowInsecureAuth entry.

LOC delta: +59 / -66, production code -32.

The policy/data-handling-redaction-disabled check could never emit a finding:
scanPolicyDataHandling records the sensitiveLoggingRedaction evidence with a
hardcoded value true, and the finding builder only fired on value !== true.
Redaction is unconditional in src/logging/redact.ts, which hardcodes tools mode
and reads only redactPatterns, so no config can turn it off.

Delete the check, its finding builder, check id, and the validateOnly fix class
that existed solely for it. Keep the public
dataHandling.sensitiveLogging.requireRedaction policy key: it is a policy.jsonc
contract, it still drives openclaw policy compare baseline strictness, and its
shape stays validated.

Make the key's satisfied status explicit instead of silent: the policy rule
declares satisfiedByInvariant pointing at the evidence source policy state
records (oc://openclaw.invariant/logging/redaction), which openclaw policy check
emits in dataHandling evidence and the attestation. A metadata test asserts every
rule names either its checks or its invariant, never both and never neither, and
that policy state actually emits the declared source.

Also drop the stale logging.redactSensitive entry from the policy config coverage
manifest; that config key is retired.
@steipete
steipete marked this pull request as ready for review July 26, 2026 02:49
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts extensions: policy size: S maintainer Maintainer-authored PR labels Jul 26, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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, 10:54 PM ET / July 26, 2026, 02:54 UTC.

ClawSweeper review

What this changes

This PR removes the policy doctor check that could never report disabled logging redaction, while retaining the policy key and recording its satisfaction through an always-on runtime invariant.

Merge readiness

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

Keep open for maintainer review: the branch replaces a named policy-doctor check with invariant-backed evidence, which needs an explicit compatibility decision. Likely related people: steipete (high confidence; recent merged policy cleanup in the same surface).

Priority: P3
Reviewed head: 1af8be7dfb27cea7ff361d0db15dbacf2a6fae70
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and internally reasoned, but its real behavior proof is limited to claimed automated validation and the public check-ID contract still needs maintainer confirmation.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports unit tests, type checks, linting, and autoreview, but provides no after-fix live openclaw policy check output, attestation output, log, recording, or linked artifact demonstrating the changed behavior; redact private configuration and endpoint details in any proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/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 unit tests, type checks, linting, and autoreview, but provides no after-fix live openclaw policy check output, attestation output, log, recording, or linked artifact demonstrating the changed behavior; redact private configuration and endpoint details in any proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Unreachable check removal: The PR head removes the redaction finding builder whose input is invariant evidence, and replaces the rule's check mapping with an explicit redaction invariant.
Invariant evidence remains: The PR retains the logging-redaction data-handling evidence entry and documents it as the satisfied source for the policy rule rather than deleting attestation input.
Prior cleanup provenance: The directly related merged PR removed the retired automatic remediation while deliberately leaving the check as a separately identified policy-contract decision; this PR is the follow-up that decides that remaining question.
Findings None None.
Security None None.

How this fits together

The policy plugin reads operator policy rules, evaluates runtime and configuration posture, and emits doctor findings plus policy evidence for openclaw policy check and its attestation. This change alters how the sensitive-log-redaction rule is represented: an invariant-backed satisfied state rather than a doctor check.

flowchart LR
  A[Operator policy file] --> B[Policy rule metadata]
  C[Logging redaction runtime] --> D[Policy evidence scan]
  B --> E[Policy evaluation]
  D --> E
  E --> F[Doctor findings]
  E --> G[Policy check output and attestation]
Loading

Decision needed

Question Recommendation
May policy/data-handling-redaction-disabled be retired from the supported policy-doctor check surface while dataHandling.sensitiveLogging.requireRedaction remains a valid invariant-backed policy contract? Approve invariant-backed retirement: Retire the unreachable check ID, retain the policy key and invariant evidence, and require live CLI proof before merge.

Why: The implementation establishes that the check cannot fire, but code inspection alone cannot decide whether external operators or automation rely on the named check ID as a compatibility contract.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports unit tests, type checks, linting, and autoreview, but provides no after-fix live openclaw policy check output, attestation output, log, recording, or linked artifact demonstrating the changed behavior; redact private configuration and endpoint details in any proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Removing the named doctor check can change integrations or operator workflows that consume policy check IDs, even though the underlying redaction invariant remains satisfied.
  • Resolve merge risk (P1) - The PR body reports tests and static checks but does not include after-fix openclaw policy check or attestation output proving the visible invariant behavior and unchanged attestation semantics in a real setup.
Agent review details

Security

None.

PR surface

Source -25, Tests +23, Docs +4, Other -9. Total -7 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 7 18 43 -25
Tests 1 28 5 +23
Docs 1 13 9 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 9 -9
Total 10 59 66 -7

Review metrics

Metric Value Why it matters
Policy enforcement representation 1 doctor check removed; 1 invariant source declared The PR changes a named policy rule from check-backed reporting to invariant-backed evidence, which is a compatibility-relevant output change rather than only dead-code deletion.

Stored data model

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

Merge-risk options

Maintainer options:

  1. Confirm retirement and prove the CLI path (recommended)
    Before merge, record maintainer approval for retiring the check ID and attach redacted after-fix openclaw policy check or attestation output for a policy declaring this rule.
  2. Pause retirement for a compatibility path
    Keep the check registered until maintainers define a deprecation or replacement contract for consumers that select it by ID.

Technical review

Best possible solution:

Confirm that retiring the documented check ID is acceptable while the policy field remains invariant-backed, then add redacted live policy-command evidence showing the rule’s evidence and attestation behavior after the change.

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

Yes, source-reproducible: the supplied diff shows the old finding path only reported evidence whose value was not true, while the redaction evidence is emitted as an unconditional true invariant. This review did not execute the target checkout's CLI path.

Is this the best way to solve the issue?

Unclear: deleting an unreachable finding is leaner than preserving dead registration, but retiring a named policy check remains a maintainer compatibility decision rather than a purely mechanical cleanup.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 77b44473c71c.

Labels

Label changes:

  • add P3: This is a focused cleanup of an unreachable check with limited expected blast radius, pending contract confirmation.
  • add merge-risk: 🚨 compatibility: The branch removes a named registered policy check ID and may change external policy-doctor consumers even though the policy field remains valid.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • 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 unit tests, type checks, linting, and autoreview, but provides no after-fix live openclaw policy check output, attestation output, log, recording, or linked artifact demonstrating the changed behavior; redact private configuration and endpoint details in any proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a focused cleanup of an unreachable check with limited expected blast radius, pending contract confirmation.
  • merge-risk: 🚨 compatibility: The branch removes a named registered policy check ID and may change external policy-doctor consumers even though the policy field remains valid.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • 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 unit tests, type checks, linting, and autoreview, but provides no after-fix live openclaw policy check output, attestation output, log, recording, or linked artifact demonstrating the changed behavior; redact private configuration and endpoint details in any proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Unreachable check removal: The PR head removes the redaction finding builder whose input is invariant evidence, and replaces the rule's check mapping with an explicit redaction invariant. (extensions/policy/src/doctor/metadata.ts:345, 1af8be7dfb27)
  • Invariant evidence remains: The PR retains the logging-redaction data-handling evidence entry and documents it as the satisfied source for the policy rule rather than deleting attestation input. (extensions/policy/src/policy-state-data.ts:52, 1af8be7dfb27)
  • Prior cleanup provenance: The directly related merged PR removed the retired automatic remediation while deliberately leaving the check as a separately identified policy-contract decision; this PR is the follow-up that decides that remaining question. (extensions/policy/src/doctor/fix-metadata.ts:327, 977c8e9d3751)
  • Compatibility-sensitive surface: The branch removes policy/data-handling-redaction-disabled from the registered policy check IDs while retaining the policy field, so existing automation that names the check ID can observe a changed doctor-check surface. (extensions/policy/src/doctor/check-ids.ts:47, 1af8be7dfb27)
  • Maintainer routing signal: The PR carries the protected maintainer label, so conservative cleanup should not close or automatically resolve the policy-contract decision.

Likely related people:

  • steipete: Authored both this focused policy cleanup and the directly preceding merged remediation removal in the same redaction-policy path. (role: recent area contributor; confidence: high; commits: 1af8be7dfb27, 977c8e9d3751; files: extensions/policy/src/doctor/metadata.ts, extensions/policy/src/doctor/data-auth-findings.ts, extensions/policy/src/policy-state-data.ts)

Rank-up moves

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

  • Attach redacted after-fix CLI output showing a policy with requireRedaction produces invariant evidence without the retired check.
  • Obtain an explicit maintainer decision on retiring the named check ID before merge.

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 08138ca into main Jul 26, 2026
234 of 243 checks passed
@steipete
steipete deleted the refactor/policy-delete-unreachable-redaction-check branch July 26, 2026 03:00
@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
…penclaw#113993)

The policy/data-handling-redaction-disabled check could never emit a finding:
scanPolicyDataHandling records the sensitiveLoggingRedaction evidence with a
hardcoded value true, and the finding builder only fired on value !== true.
Redaction is unconditional in src/logging/redact.ts, which hardcodes tools mode
and reads only redactPatterns, so no config can turn it off.

Delete the check, its finding builder, check id, and the validateOnly fix class
that existed solely for it. Keep the public
dataHandling.sensitiveLogging.requireRedaction policy key: it is a policy.jsonc
contract, it still drives openclaw policy compare baseline strictness, and its
shape stays validated.

Make the key's satisfied status explicit instead of silent: the policy rule
declares satisfiedByInvariant pointing at the evidence source policy state
records (oc://openclaw.invariant/logging/redaction), which openclaw policy check
emits in dataHandling evidence and the attestation. A metadata test asserts every
rule names either its checks or its invariant, never both and never neither, and
that policy state actually emits the declared source.

Also drop the stale logging.redactSensitive entry from the policy config coverage
manifest; that config key is retired.
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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts 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