Skip to content

refactor(config): share audit positional scanning - #148643

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/config-audit-positional-scanning-current-20260914
Sep 15, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/config-audit-positional-scanning-current-20260914

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

This maintainer-requested refactor is part of the approved duplication and complexity reduction deliverable. Config-audit redaction repeats option and positional scanning for the config set command and its path/value arguments. One bounded scanner now owns that logic.

User Impact

Redaction behavior is unchanged. Command discovery accepts only the first meaningful positional when it is set; value discovery collects the first two positionals and preserves their original indexes. Each scan starts with independent option-terminator state. Known value options, inline options, unknown dash options and dash-leading values keep their existing treatment.

Why This Change Was Made

The shared scanner takes a start index and positional limit. Its caller still recognizes the command. Generic secret redaction runs first, batch-JSON masking covers the full tail, and sensitive positional masking runs last. The eight-argument cap for fresh records and uncapped historical scrub behavior are unchanged.

The scanner change leaves the asynchronous SQLite audit writer and separate synchronous API intact. Current-main source review also preserves its later authority callback and shared main-thread SQL spy helper; the merge must retain those newer changes along with the four authored cases.

Production: -14 lines. Tests: +60 lines. No config shape, schema, sensitive-path policy, storage or CLI parsing change. This mechanical refactor needs no changelog entry.

Evidence

  • Normal CI and Workflow Sanity passed on exact head fece6d724cc9a8f0b4d923ac975653ddc1392704.
  • The actual audit test job passed all 37 audit cases, including the four additions, on tested merge 14da66fa0abd289b9c4fca3dedd45b0c696104ba. Its reviewed owner and test bytes were bound separately from current-main source admission.
  • The four added public record-builder cases cover independent command/value terminators, inline options with dash-leading values, batch JSON after both positionals and a terminator, and a non-set command whose later positional is set. Existing cap, off-thread persistence, canonical async-close and historical-scrub coverage remains.
  • One P2 review of the exact head against 0d081a0ee88ae9ee8c0049974ecf48a196bf5216 reported no actionable finding. Broader executor and independent source reviews covered the complete audit owner, callers, redaction and sensitive-path callees, SQLite ownership, lifecycle, current-main changes and relevant history.
  • The latest exact-head ClawSweeper review has no actionable finding, Before merge item or Rank-up move. Its static-only limitation is separate from the hosted execution above.

This is fixture and source evidence for the audit boundary. No live operator CLI session or production historical-scrub execution is claimed.

@vincentkoc vincentkoc self-assigned this Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 15, 2026 00:22
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 8:28 PM ET / September 15, 2026, 00:28 UTC.

ClawSweeper review

What this changes

The PR shares command-line argument scanning within configuration audit redaction and adds four cases covering existing masking behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, behavior-preserving cleanup that remains absent from current main. No actionable introduced defect was found, and the maintainer-authored PR is protected from automatic closure.

Priority: P3
Reviewed head: fece6d724cc9a8f0b4d923ac975653ddc1392704

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with meaningful boundary coverage and no identified correctness defect; execution remains outside this source review.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored internal redaction refactor is exempt from the external-contributor proof gate and does not change authority; the body explicitly makes no executed CLI, persistence, or historical-scrub claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored internal redaction refactor is exempt from the external-contributor proof gate and does not change authority; the body explicitly makes no executed CLI, persistence, or historical-scrub claim.
Evidence reviewed 8 items Introduced change preserves scanner semantics: The pinned parent-to-head diff replaces two equivalent loops with one bounded scanner. Both callers retain independent option-terminator state, original argument indexes, known-option value skipping, and first-positional command recognition. Batch masking still scans the entire tail before sensitive positional masking.
Current main still contains the duplication: Current main retains separate command and path/value scanners. Its later audit-writer authority callback is outside the introduced hunks and is not a regression attributable to this PR.
Latest release retains separate scanners: The v2026.9.4 source also contains both scanners; the proposed consolidation is not already present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

Configuration auditing records diagnostic information about configuration reads and writes. Its argument redactor masks credentials before records reach SQLite and also sanitizes historical audit logs through Doctor.

flowchart TD
  A[Configuration reads and writes] --> B[Bounded process arguments]
  C[Historical audit logs] --> D[Secret argument redaction]
  B --> D
  D --> E[Shared command and positional scanner]
  E --> F[Batch and sensitive value masking]
  F --> G[Sanitized audit records]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -14, Tests +60. Total +46 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 29 -14
Tests 1 60 0 +60
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 75 29 +46

Review metrics

None.

Technical review

Best possible solution:

Keep one private positional scanner while preserving existing redaction order, argument bounds, and audit persistence contracts.

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

Not applicable: the PR proposes behavior-preserving consolidation, not a bug fix; source comparison supports equivalence, and no tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes: parameterizing the existing scanner removes duplicated logic without creating a parallel redaction policy or changing public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6001ca4b418c.

Labels

Label justifications:

  • P3: This is a bounded internal cleanup with unchanged user behavior and no identified regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored internal redaction refactor is exempt from the external-contributor proof gate and does not change authority; the body explicitly makes no executed CLI, persistence, or historical-scrub claim.

Evidence

What I checked:

  • Introduced change preserves scanner semantics: The pinned parent-to-head diff replaces two equivalent loops with one bounded scanner. Both callers retain independent option-terminator state, original argument indexes, known-option value skipping, and first-positional command recognition. Batch masking still scans the entire tail before sensitive positional masking. (src/config/io.audit.ts:43, fece6d724cc9)
  • Current main still contains the duplication: Current main retains separate command and path/value scanners. Its later audit-writer authority callback is outside the introduced hunks and is not a regression attributable to this PR. (src/config/io.audit.ts:43, 6001ca4b418c)
  • Latest release retains separate scanners: The v2026.9.4 source also contains both scanners; the proposed consolidation is not already present in the supplied latest release. (src/config/io.audit.ts:40, 3a9d69db306c)
  • Tests protect observable record output: The four added table entries exercise the existing public record builder, covering independent terminators, inline options with dash-leading values, full-tail batch masking, and a non-set command. Existing cap, persistence, async-close, and historical-scrub tests remain intact. Tests were inspected but not executed. (src/config/io.audit.test.ts:507, fece6d724cc9)
  • Production redaction boundary: Configuration writes construct audit records through createConfigWriteAuditRecordBase; observation records snapshot the same sanitized process information. Persistence sanitization and historical scrubbing continue using the same redactor. The introduced patch changes neither storage contracts nor authorization. (src/config/io.audit.ts:669, fece6d724cc9)
  • Recent area history: Current-main history identifies recent audit persistence and lifecycle work by Peter Steinberger; GitHub commit metadata maps the persistence commit author to steipete. This supports routing, not attribution of scanner introduction. (src/config/io.audit.ts, dbde270238db)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@vincentkoc
vincentkoc merged commit 5a826aa into main Sep 15, 2026
263 of 264 checks passed
@vincentkoc
vincentkoc deleted the refactor/config-audit-positional-scanning-current-20260914 branch September 15, 2026 07:27
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '0945dabbe487213e95e84a72ad1aae3659e0e000': (115 commits)
  fix: omit automation service aliases from squash coauthors (#148883)
  test: restore services typecheck shard headroom (#148885)
  perf(trajectory): avoid native probes for truncation records (#148870)
  improve(gateway): load cron only when reload requests it (#143500)
  fix: resolve issue #146088 — [Bug]: The most recent Linux AppImage does not ship with the correct versions of libs needed to run (#148174)
  refactor(theme): share nonvirtual ANSI color lookup (#148717)
  perf(gateway): scope exact session row topology reads (#148836)
  improve(memory): reduce vector replacement overhead (#148201)
  fix(i18n): keep HTTP headers out of native translations (#147119)
  refactor(plugins): share source-root display formatting (#148646)
  fix(cron): reject blank script paths before mutations (#148787)
  refactor(config): share audit positional scanning (#148643)
  fix(test): restore infrastructure typecheck shard headroom (#148861)
  fix(release): harden package validation fallbacks (#148729)
  refactor(config): share leaf and descendant unset pruning (#148216)
  test: reuse prepared runtime for pristine preflight (#148858)
  fix(ui): settle global model drafts across agent switches (#148843)
  fix(queue): avoid repeated scans when cancelling backlogs (#148754)
  fix(logging): orphaned \\\\?\\ path markers corrupt redacted Windows diagnostics (#147542)
  refactor(hooks): share optional reply metadata projection (#148641)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant