Repository navigation
Conversation
|
🦞👀 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: needs maintainer review before merge. What this changesThis PR sanitizes terminal controls in human-readable storage location reports while preserving storage targets and JSON values. Example: Run openclaw storage list with archive targeting a Linux directory containing café, an ANSI color sequence, and an embedded newline before forged.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it fixes a current storage-reporting defect with a focused change and no actionable findings; exact-head CI remains in progress. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe storage CLI obtains configured destinations and provider health results, then renders human reports or JSON through the storage command owner. flowchart LR
A[Storage CLI] --> B[Storage commands]
B --> C[Storage locations and providers]
C --> D[Filesystem or object storage]
C --> B
B --> E[Terminal sanitizer]
E --> F[Human reports]
B --> G[Raw JSON]
Technical reviewBest possible solution: Use the existing terminal sanitizer at the storage command’s human-output boundary while retaining raw values for storage operations and JSON. Do we have a high-confidence way to reproduce the issue? Current-main source exposes raw targets and diagnostics to terminal output, and supplied real CLI traces demonstrate the failing input; no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete repair: it sanitizes display text through the existing owner, preserves trusted separators, and changes no provider or persistence contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 008cf7bc06ab. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +4, Tests +27, Docs +4. Total +35 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 25, 2026, 7:44 PM ET / 23:44 UTC (Revision 2). |
Integrate current main and simplify storage output sanitization while preserving raw storage targets and JSON values. Co-authored-by: Alix-007 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
|
Thanks @steipete for reviewing and merging this! I appreciate your help getting this focused fix landed. |
…183359) Co-authored-by: Alix-007 <[email protected]>
Co-authored-by: Alix-007 <[email protected]> (cherry picked from commit a006151) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 9151594fbf7cb4ded45a0765889b294a65cff98c)
…[baseline validation follow-up] Co-authored-by: Alix-007 <[email protected]> Complete the source-equivalent baseline adaptation and checked-in regressions; normalize with the checkout formatter. (cherry picked from commit a006151) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e2d8f9941772f6ca79c50c0ef319eae6f02f6eed)
What Problem This Solves
Fixes terminal escape execution and forged rows when storage provider targets or diagnostics contain control characters.
User Impact
Storage reports show readable escaped text. Actual filesystem targets, stored objects, and JSON retain their original values.
Why This Change Was Made
Reuse
sanitizeTerminalTextin the existing human report owner. The list summary and diagnostic are sanitized separately so the report's own newline remains structural. The simplification pass removed the intermediate row array and avoided sanitizing the already-validated storage-test name. Thanks @Alix-007 for the fix and regression coverage.Evidence
Integrated head:
fa4215237809e8cb0b09c35c9747bbba7f1da4e0; contributor commits are preserved.ee6efea4f8c5because the target and diagnostic contain raw controls. Those owner/test files match integrated maine79654199eb1. With the fix, the fullsrc/cli/program/register.storage.test.tsfile passes: 5 passed.node scripts/run-vitest.mjs src/cli/program/register.storage.test.ts --maxWorkers=1; baseline additionally selects-t 'escapes terminal controls'. Wrapper wall time: red 266.48s, green 164.09s (Vitest 130.59s). Cold worker compilation dominates; the regression reaches registered CLI commands and real filesystem I/O. Per-file CI seconds are not available locally.git diff --checkpass. Independent Codex review: scoped-clean P0–P2, no actionable findings.openclaw/ci-gate; GitHub reports the PR mergeable.Not live-tested independently on the integrated head: a fresh built CLI would add build/setup work on the shared host. The contributor's prior-head Linux CLI proof is retained below: list and init stop emitting controls, JSON preserves the exact target, and a real 256-byte filesystem probe is deleted after readback. Those traces are prior-head evidence.
Contributor CLI proof retained from original head ccb6356 (prior-head evidence)
JSON escaping makes control bytes inspectable without executing them. Temporary roots are replaced with
$FIXTURE.{ "phase": "red", "head": "e8b251188f502b088dd037936062a1711ea302e1", "at": "2026-10-25T06:06:01.553Z", "runs": [ { "label": "uninitialized-list", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list" ], "code": 0, "signal": null, "stdout": "archive (filesystem): unavailable — $FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007\n Storage location \"archive\" ($FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007) has no initialization marker. If this is a new location, run `openclaw storage init archive`; otherwise reconnect the disk or check the bucket and prefix.\n", "stderr": "", "seconds": 4.670171441 }, { "label": "init", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "init", "archive" ], "code": 0, "signal": null, "stdout": "Storage location archive initialized: $FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007\n", "stderr": "", "seconds": 4.197572896 }, { "label": "initialized-list", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list" ], "code": 0, "signal": null, "stdout": "archive (filesystem): ok — $FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007\n", "stderr": "", "seconds": 4.309546932000001 }, { "label": "json", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"locations\": [\n {\n \"name\": \"archive\",\n \"provider\": \"filesystem\",\n \"encrypted\": false,\n \"displayTarget\": \"$FIXTURE/café\\u001b[31m\\noperator-forged\\tend\\rrow\\u0007\",\n \"state\": \"ok\",\n \"freeBytes\": 133654654976,\n \"totalBytes\": 643928428544\n }\n ]\n}\n", "stderr": "", "seconds": 4.1370671880000005 }, { "label": "roundtrip", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "test", "archive", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"name\": \"archive\",\n \"provider\": \"filesystem\",\n \"displayTarget\": \"$FIXTURE/café\\u001b[31m\\noperator-forged\\tend\\rrow\\u0007\",\n \"locationId\": \"9ad7b866-8ac2-47e3-8ca1-9b533855036e\",\n \"encrypted\": false,\n \"state\": \"ok\",\n \"sizeBytes\": 256\n}\n", "stderr": "", "seconds": 4.310101756 } ], "observations": [ { "label": "uninitialized-list", "controls": 6, "forgedLine": true, "escapedLine": false, "unicode": true }, { "label": "init", "controls": 3, "forgedLine": true, "escapedLine": false, "unicode": true }, { "label": "initialized-list", "controls": 3, "forgedLine": true, "escapedLine": false, "unicode": true } ], "readback": { "rawTarget": "$FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007", "state": "ok", "roundtripBytes": 256, "probeDeleted": true, "existingDataUnchanged": true, "configUnchanged": true }, "result": "PASS" }{ "phase": "green", "head": "ccb635699023cbf55ee45fe476b99906e63c1050", "at": "2026-10-25T06:36:06.830Z", "runs": [ { "label": "uninitialized-list", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list" ], "code": 0, "signal": null, "stdout": "archive (filesystem): unavailable — $FIXTURE/café\\noperator-forged\\tend\\rrow\n Storage location \"archive\" ($FIXTURE/café\\noperator-forged\\tend\\rrow) has no initialization marker. If this is a new location, run `openclaw storage init archive`; otherwise reconnect the disk or check the bucket and prefix.\n", "stderr": "", "seconds": 4.790873272 }, { "label": "init", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "init", "archive" ], "code": 0, "signal": null, "stdout": "Storage location archive initialized: $FIXTURE/café\\noperator-forged\\tend\\rrow\n", "stderr": "", "seconds": 4.363226497 }, { "label": "initialized-list", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list" ], "code": 0, "signal": null, "stdout": "archive (filesystem): ok — $FIXTURE/café\\noperator-forged\\tend\\rrow\n", "stderr": "", "seconds": 4.800287902999998 }, { "label": "json", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "list", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"locations\": [\n {\n \"name\": \"archive\",\n \"provider\": \"filesystem\",\n \"encrypted\": false,\n \"displayTarget\": \"$FIXTURE/café\\u001b[31m\\noperator-forged\\tend\\rrow\\u0007\",\n \"state\": \"ok\",\n \"freeBytes\": 123456098304,\n \"totalBytes\": 643928428544\n }\n ]\n}\n", "stderr": "", "seconds": 4.306450039000001 }, { "label": "roundtrip", "args": [ "$CHECKOUT/openclaw.mjs", "storage", "test", "archive", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"name\": \"archive\",\n \"provider\": \"filesystem\",\n \"displayTarget\": \"$FIXTURE/café\\u001b[31m\\noperator-forged\\tend\\rrow\\u0007\",\n \"locationId\": \"99faa1b6-6192-4af6-b82f-75c097c9d81f\",\n \"encrypted\": false,\n \"state\": \"ok\",\n \"sizeBytes\": 256\n}\n", "stderr": "", "seconds": 4.222617351000001 } ], "observations": [ { "label": "uninitialized-list", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true }, { "label": "init", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true }, { "label": "initialized-list", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true } ], "readback": { "rawTarget": "$FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007", "state": "ok", "roundtripBytes": 256, "probeDeleted": true, "existingDataUnchanged": true, "configUnchanged": true }, "result": "PASS" }Replay scripts, focused checks and independent review
Save the following two files together in a directory outside both product checkouts. Set
CHECKOUTto the absolute clean checkout of either SHA,HARNESS_DIRto that external script directory, andPHASE=redfor base orPHASE=greenfor head. Build each checkout normally; do not copy output or edit build stamps.proof-common.mjs:proof-storage.mjs:{ "focusedChecks": [ { "log": "storage-tests-green.log", "seconds": 360.51, "tests": "5 passed (5)", "command": "OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/program/register.storage.test.ts --maxWorkers=1" }, { "log": "storage-tests-final.log", "seconds": 135.71, "tests": "1 passed | 4 skipped (5)", "command": "OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/program/register.storage.test.ts --maxWorkers=1 -t 'escapes terminal controls'" } ], "independentReview": { "sourceVerdict": "pass", "findings": [], "scope": { "independent": true, "scope": "Full base-to-candidate diff, owning storage command functions, CLI registration, storage locations/provider contracts, human and JSON branches, terminal sanitizer, regression tests and docs.", "conclusion": "All dynamic successful report fields and probe messages are sanitized only at human display egress. Structural list newlines remain trusted. Provider settings, backend paths, operation arguments, data and JSON projections are unchanged.", "testAudit": "New regression exercises registered CLI and real filesystem storage target. Existing tests retain ordinary roundtrip, provider failure redaction and no-write rejection contracts. No test-only production seams added." }, "hashes": { "src/commands/storage.ts": "770760c079671718ffc7828035992f24f50cb920e06d7d2b7fb15897a2d0f973", "src/cli/program/register.storage.test.ts": "e7a1a46c1ce3b0e2ab880c0e3d23537904e7c3c4393273db07249e3b2f731978", "docs/cli/storage.md": "003d86c49e6d7a93beeb834b9f0661f3a6320bd9fb7e5ca644a99b3031ba1418" }, "staticGates": { "targetedTypecheck": "pass; root executed official node scripts/run-tsgo.mjs -p ../storage-review-types.json with OPENCLAW_TYPECHECKER=tsgo and 600000ms watchdog after cold-build load subsided; root reported native session 35155 completed exit 0. Reviewer inspected storage-types-final.log: artifact-lock wait only, no diagnostics, and unchanged external config extending canonical commands shard with changed-test include and inherited ambient files. Earlier 180000ms reviewer attempt timed out without diagnostics; retained as historical capacity failure, not its passing evidence.", "targetedLint": "pass; official run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/commands/storage.ts src/cli/program/register.storage.test.ts, OPENCLAW_LINT_TOOL=oxlint; type-aware and unused-disable checks enabled by wrapper, exit 0", "targetedFormat": "pass; official run-format.mts --check across all 3 candidate files, OPENCLAW_FORMAT_TOOL=oxfmt; all matched files correct, exit 0", "diffCheck": "pass; git diff --check exit 0" }, "exactHeadProof": { "status": "PASS", "productHead": "ccb635699023cbf55ee45fe476b99906e63c1050", "observations": [ { "label": "uninitialized-list", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true }, { "label": "init", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true }, { "label": "initialized-list", "controls": 0, "forgedLine": false, "escapedLine": true, "unicode": true } ], "readback": { "rawTarget": "$FIXTURE/café\u001b[31m\noperator-forged\tend\rrow\u0007", "state": "ok", "roundtripBytes": 256, "probeDeleted": true, "existingDataUnchanged": true, "configUnchanged": true } } } }