Repository navigation
fix(test): redact credentials from Vitest failure reports - #150983
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 17, 2026, 1:05 PM ET / 17:05 UTC (Revision 2). ClawSweeper reviewWhat this changesRedacts 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 Review scores
Verification
How this fits togetherVitest 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +1002, Other +4. Total +1009 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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.
|
Merged via squash.
|
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
…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
…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
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:
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, andredacts 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.mjscompleted 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.tscasedrains 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
0a55256and once at merge base9bea925on 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 reportedrollup=green,github_rollup=SUCCESS, andpending=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.mtsgenerates 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.