Skip to content

fix(test): redact credentials from Vitest failure reports - #150983

Merged
steipete merged 2 commits into
mainfrom
upd/test-diff-env-redaction
Sep 17, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/test-diff-env-redaction

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150898

What Problem This Solves

Fixes credential values appearing in public CI failure reports when assertions compare environment or configuration objects. This class of exposure was observed in run 35222673726.

User Impact

Developers retain credential key names and value lengths in test diagnostics without exposing the values. Application and update behavior are unchanged. Test console capture remains out of scope; tests must still avoid logging credentials directly.

Why This Change Was Made

A shared reporter factory wraps the selected Vitest reporters, including CLI overrides, independent UI/browser configurations, and native report merging. One policy scrubs assertion messages, diffs, expected/actual values, stacks, nested errors, source excerpts, and annotations. It handles Node's multiline string fragments, credential entry pairs such as Object.entries-shaped data (including clipped diff hunks), and preserves JSON syntax and GitHub annotation framing. Unquoted environment records treat the entire right-hand side of one line as the value. Reporter choices, options, failure exit codes, and native blob-merge rejection remain intact. No dependency, config-option, environment-variable, schema, or baseline changes are introduced.

The three shared owners are:

  • test/vitest/vitest.reporters.ts: installs the wrapped reporter list after config and CLI resolution, so shared, fast, UI/browser, and report-merge configurations inherit the same policy.
  • test/vitest/redacting-reporter.ts: delegates to the selected native/custom reporters after scrubbing task errors and metadata, source frames, and GitHub annotation titles/bodies.
  • test/vitest/credential-redaction.ts: owns the case-insensitive credential-key matcher and redaction of object, JSON, and environment-style diagnostic text.

Harness/tooling LOC is +642/−18; application runtime LOC is unchanged. The blocks are:

  • Reporter wrapper (+281): preserves reporter hooks/options and asynchronous initialization while covering late source frames and encoded annotations, with console capture excluded.
  • Policy module (+266): handles quoted/bare values, multiline inspector fragments, entry pairs, nested JSON, decoded lengths, and idempotent redaction in one place.
  • Factory wiring (+76/−3): makes shared, fast, UI/browser, and CLI-selected reporters inherit the wrapper.
  • Report-merge handling (+19/−15): routes generated merge configuration through the same reporter factory.

Tests add +385/−17 and documentation adds +17.

Evidence

  • 34 policy tests and four real child-run regressions pass, including redacts deep-equality failures through the shard runner, redacts spy-call failures through the shard runner, redacts node-multiline failures through the shard runner, and redacts entries-array failures through the shard runner. Deep-equality and spy-call failures contain <redacted len=34> and omit the synthetic value; native multiline assertions are also redacted. Coverage includes stdout/stderr, source excerpts, JSON/JUnit, the CI resource reporter, and encoded GitHub annotation titles and bodies.

  • The entries-array child regression fails on the previous head because the synthetic value reaches output; pair-aware structured and text redaction makes it pass. It also covers a clipped diff hunk that omits the entry's opening bracket. Disabling reporter wiring makes both original child regressions fail. Additional bare-value and multiline tests fail before their corresponding parser fixes and pass afterward.

  • Config inheritance and CLI override contracts pass for core, fast, UI/browser, E2E, and custom reporters. Shared home isolation passes.

  • Four selected native report-merge cases pass, preserving successful results, assertion failures, unhandled errors, and suite errors.

  • node scripts/check-changed.mjs completed successfully after the tuple-pair fix.

  • Fresh committed-branch autoreview (--mode branch --base origin/main --max-priority P1) is scoped-clean with no accepted/actionable P0/P1 findings.

  • Representative unit-fast shard 1/32: 509 passed, one 120-second timeout in the unchanged bench-agent-concurrency.test.ts case drains detached gateway active work before the next spawn sample. The maintainer classified this as local host overload; the test and owner sources are untouched. It was not rerun. Hosted CI is the proof of record.

  • The preceding head's real-Gateway widget timeouts were accepted by the maintainer as an unrelated flake: both cases passed once at head 0a55256 and once at merge base 9bea925 on Blacksmith Testbox, using the same two-worker isolated-fork settings. The CI diagnostics showed widget acquisition RPC errors after Gateway connection. The lease was stopped; no CI rerun was requested.

Maintainer landing evidence

Exact-head CI run 35249843668 is green at 79fe0fde9ba77c1643368faa2c8bd901746f103b: the native watcher reported rollup=green, github_rollup=SUCCESS, and pending=0. No CI rerun was requested.

ClawSweeper's exact-head revision 2 review identifies no actionable patch defect. Its remaining “Add data-model compatibility proof” checkbox is skipped: scripts/lib/vitest-report-owner.mts generates a temporary Vitest merge configuration and now installs the same reporter plugin there. It changes diagnostic artifacts, not persisted application state, SQLite schemas, stored settings, or an application upgrade contract. This agrees with the technical review's explicit finding that the earlier migration blocker does not apply. Native report-merge regressions cover successful results, assertion failures, unhandled errors, and suite errors. Application and update behavior are unchanged; no application migration is required.

Prevent assertion diagnostics from exposing credential-shaped values in public CI logs. Centralize print-time redaction across shared reporters and report merging, preserving key names and value lengths. This class was observed in run 35222673726; console capture remains out of scope.
@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 17, 2026 16:05
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui scripts Repository scripts size: L maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 17, 2026, 1:05 PM ET / 17:05 UTC (Revision 2).

ClawSweeper review

What this changes

Redacts credential values from Vitest failure diagnostics, selected reporters, and merged reports while preserving credential names and value lengths.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, protected maintainer PR; no blocking patch defect was identified. The previous migration blocker is unsupported: the change affects diagnostic artifacts, not persisted application state or upgrade contracts.

Priority: P1
Reviewed head: 79fe0fde9ba77c1643368faa2c8bd901746f103b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent infrastructure fix with meaningful reported boundary regressions and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied repository state identifies a maintainer-authored PR, so external-contributor proof is not required. Reported child-run evidence exercises the actual shard-runner reporter boundary and checks redacted diagnostics, report files, annotations, and preserved failure exits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored PR, so external-contributor proof is not required. Reported child-run evidence exercises the actual shard-runner reporter boundary and checks redacted diagnostics, report files, annotations, and preserved failure exits.
Evidence reviewed 9 items Introduced scope: The verified merge-base-to-head delta contains reporter policy, reporter wiring, regression coverage, and documentation. It introduces no application migration, dependency change, or stored user setting.
Reporter boundary: The wrapper scrubs task results, metadata, annotations, and error output before delegating reporter hooks; asynchronous initialization is joined by subsequent hooks. Console capture has an explicit separate boundary.
Regression coverage and captured evidence: The captured PR body, sourceRevision b3594356bd29a521e389382e9d27c3ade84105630f6aa4e5ea246b188b976d73, reports four passing child-run regressions and four native report-merge cases. Inspected tests launch scripts/run-vitest.mjs and assert failure exit status, redacted stdout/stderr, JSON/JUnit output, and encoded GitHub annotations. These results were reported by the author, not independently executed in this review.
Findings None None.
Security None None.

How this fits together

Vitest runs OpenClaw's automated tests and sends results to console, CI annotations, and report files. The new reporter boundary sanitizes diagnostic data before those outputs are produced.

flowchart LR
  A[Test assertions] --> B[Errors and metadata]
  C[Configured or CLI reporters] --> D[Shared reporter wrapper]
  B --> D
  D --> E[Credential redaction]
  E --> F[Native and custom reporters]
  F --> G[Console and CI annotations]
  F --> H[JSON and JUnit reports]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +3, Tests +1002, Other +4. Total +1009 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 2 5 2 +3
Tests 8 1020 18 +1002
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 19 15 +4
Total 11 1044 35 +1009

Review metrics

Metric Value Why it matters
Production versus test growth Application runtime +0; tooling net +624; tests net +368 The growth is confined to test infrastructure, with stated justification for parsing diagnostics and preserving reporter behavior.

Stored data model

Persistent data-model change detected: serialized state: scripts/lib/vitest-report-owner.mts, unknown-data-model-change: scripts/lib/vitest-report-owner.mts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one unconditional test-diagnostic redaction boundary while retaining native reporter selection, failure outcomes, and report aggregation.

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

Yes, a concrete source-backed path exists: fail an environment-object comparison through the shard runner and inspect reporter output. The author reports before/after failures; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. Central reporter wrapping covers configured and CLI-selected outputs without changing assertion logic; the prior application-migration requirement does not apply.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5ef3f1a1ed93.

Labels

Label justifications:

  • P1: The PR addresses reported exposure of credential values in public CI assertion diagnostics.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 supplied repository state identifies a maintainer-authored PR, so external-contributor proof is not required. Reported child-run evidence exercises the actual shard-runner reporter boundary and checks redacted diagnostics, report files, annotations, and preserved failure exits.

Evidence

What I checked:

  • Introduced scope: The verified merge-base-to-head delta contains reporter policy, reporter wiring, regression coverage, and documentation. It introduces no application migration, dependency change, or stored user setting. (test/vitest/vitest.reporters.ts:29, 79fe0fde9ba7)
  • Reporter boundary: The wrapper scrubs task results, metadata, annotations, and error output before delegating reporter hooks; asynchronous initialization is joined by subsequent hooks. Console capture has an explicit separate boundary. (test/vitest/redacting-reporter.ts:183, 79fe0fde9ba7)
  • Regression coverage and captured evidence: The captured PR body, sourceRevision b3594356bd29a521e389382e9d27c3ade84105630f6aa4e5ea246b188b976d73, reports four passing child-run regressions and four native report-merge cases. Inspected tests launch scripts/run-vitest.mjs and assert failure exit status, redacted stdout/stderr, JSON/JUnit output, and encoded GitHub annotations. These results were reported by the author, not independently executed in this review. (test/vitest-redacting-reporter.test.ts:76, 79fe0fde9ba7)
  • Dependency contract: The patch directly imports Vitest reporter interfaces and constructors. Vitest v5.0.0 defines the inspected lifecycle hooks, including synchronous onInit; its native JSON and blob reporters consume task results. The tag resolves to this dependency commit. (packages/vitest/src/node/types/reporter.ts:11, f441c6fab25e)
  • Current main and release comparison: Fetched main still selects native verbose/GitHub Actions reporters without this wrapper. Tree inspection found none of the new reporter/redaction modules on fetched main or v2026.9.4; no verified merged replacement establishes redundancy. (test/vitest/vitest.shared.config.ts:469, 5ef3f1a1ed93)
  • Release surface check: The latest supplied release has no matching redaction or reporter-factory module under test/vitest. (3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-17T16:12:07.717Z sha 0a55256 :: blocked before merge. :: none

Scrub credential values in Object.entries-shaped diagnostics and serialized tuple pairs, including diff hunks that omit the opening bracket. Cover structured values, encoded text, and a failing child Vitest run with synthetic data.
@steipete
steipete merged commit b49bc74 into main Sep 17, 2026
180 checks passed
@steipete
steipete deleted the upd/test-diff-env-redaction branch September 17, 2026 17:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 18, 2026
Fix intermittent Canvas and dashboard sandbox failures in Linux real-Gateway tests. The shared fixture previously selected a kernel client-range Gateway port while the lazy sandbox used the adjacent, unchecked port. An outbound connection could occupy that sandbox port before its listener started.

Use the existing port-block allocator to check Gateway and sandbox listeners outside the Linux client range, then retain exact Gateway-port reservation across CLI work and restarts. Explicit caller-owned ports remain caller-owned. Production behavior and browser waits are unchanged.

Validation: exact-head CI run 35297154119 is green; recorded Linux proof covers the original collision, 78 helper tests, 20 Canvas file repetitions, and the complete 30-file/60-test real-Gateway suite. Committed-branch Codex review is scoped-clean and the landing rebase is patch-identical.

Related: #151003, #150983
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…50983)

Prevent credential-shaped values from appearing in public Vitest assertion diagnostics while preserving credential key names and value lengths. This exposure class was observed in CI run 35222673726.

Use one shared reporter factory and redaction policy for configured and CLI-selected reporters, UI/browser configurations, and native report merging. Scrub task errors, expected/actual values, diffs, source excerpts, and encoded GitHub annotations before delegating to the selected reporters. Preserve reporter options, failure exits, and native blob-merge rejection. Test console capture remains outside this boundary.

Application runtime and update behavior are unchanged. No configuration option, dependency, stored setting, schema, or application migration changes. The report owner generates temporary diagnostic configuration, so ClawSweeper's residual data-model compatibility checkbox does not apply.

Validation: 34 policy tests, four real child-run regressions, config/CLI inheritance checks, and four native report-merge cases are reported passing. The r2 review of record is scoped-clean with no accepted/actionable P0/P1 findings. Exact-head CI run 35249843668 is green with zero pending checks; no rerun was requested.

Related: openclaw#150898
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…aw#151140)

Fix intermittent Canvas and dashboard sandbox failures in Linux real-Gateway tests. The shared fixture previously selected a kernel client-range Gateway port while the lazy sandbox used the adjacent, unchecked port. An outbound connection could occupy that sandbox port before its listener started.

Use the existing port-block allocator to check Gateway and sandbox listeners outside the Linux client range, then retain exact Gateway-port reservation across CLI work and restarts. Explicit caller-owned ports remain caller-owned. Production behavior and browser waits are unchanged.

Validation: exact-head CI run 35297154119 is green; recorded Linux proof covers the original collision, 78 helper tests, 20 Canvas file repetitions, and the complete 30-file/60-test real-Gateway suite. Committed-branch Codex review is scoped-clean and the landing rebase is patch-identical.

Related: openclaw#151003, openclaw#150983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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