Skip to content

fix(storage): escape terminal controls in location reports - #183359

Merged
steipete merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-storage-terminal-controls-20261025
Oct 26, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-storage-terminal-controls-20261025

Conversation

@Alix-007

@Alix-007 Alix-007 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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 sanitizeTerminalText in 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.

  • The registered-CLI regression fails on main ee6efea4f8c5 because the target and diagnostic contain raw controls. Those owner/test files match integrated main e79654199eb1. With the fix, the full src/cli/program/register.storage.test.ts file passes: 5 passed.
  • Commands: 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.
  • Targeted type-aware oxlint, oxfmt, and git diff --check pass. Independent Codex review: scoped-clean P0–P2, no actionable findings.
  • Production +6/−2 (+4), tests +27, docs +4. This removes five production lines from the contributor proposal. The remaining growth imports and applies the canonical sanitizer while preserving the report's own line separator; no obsolete nearby path warranted unrelated cleanup.
  • Exact-head PR CI run 40245685877 is green, including 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 CHECKOUT to the absolute clean checkout of either SHA, HARNESS_DIR to that external script directory, and PHASE=red for base or PHASE=green for head. Build each checkout normally; do not copy output or edit build stamps.

cd "$CHECKOUT"
pnpm install --frozen-lockfile
OPENCLAW_TYPECHECKER=tsgo node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup
cd "$HARNESS_DIR"
node proof-storage.mjs "$CHECKOUT" "$PHASE"

proof-common.mjs:

import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import {createHash} from 'node:crypto';
import {execFileSync, spawn} from 'node:child_process';

export const unusual = 'café\x1b[31m\noperator-forged\tend\rrow\x07';

export function fixture(name) {
 const checkout=path.resolve(process.argv[2]);
 const phase=process.argv[3];
 assert.ok(['red','green'].includes(phase));
 const head=execFileSync('git',['rev-parse','HEAD'],{cwd:checkout,encoding:'utf8'}).trim();
 assert.equal(execFileSync('git',['status','--porcelain'],{cwd:checkout,encoding:'utf8'}).trim(),'');
 const stamp=JSON.parse(fs.readFileSync(path.join(checkout,'dist/.buildstamp')));
 assert.equal(stamp.head,head);
 assert.equal(stamp.inputsClean,true);
 const root=fs.mkdtempSync(path.join(os.tmpdir(),`alix-escape-${name}-`));
 for(const leaf of ['home','state','workspace','tmp'])fs.mkdirSync(path.join(root,leaf));
 const configPath=path.join(root,'openclaw.json');
 const config={agents:{ownership:'explicit',defaults:{systemAgent:{agentId:'main'}},entries:{main:{workspace:path.join(root,'workspace')}}},tools:{profile:'minimal'},plugins:{allow:[],slots:{memory:'none'}},logging:{level:'warn',consoleLevel:'warn',file:path.join(root,'runtime.log')}};
 const writeConfig=()=>fs.writeFileSync(configPath,JSON.stringify(config),{mode:0o600});
 writeConfig();
 const env={PATH:`${path.dirname(process.execPath)}:/usr/bin:/bin`,HOME:path.join(root,'home'),TMPDIR:path.join(root,'tmp'),LANG:'C.UTF-8',TZ:'UTC',TERM:'dumb',NO_COLOR:'1',COLUMNS:'320',CI:'1',DO_NOT_TRACK:'1',OPENCLAW_CONFIG_PATH:configPath,OPENCLAW_STATE_DIR:path.join(root,'state'),OPENCLAW_NO_RESPAWN:'1',OPENCLAW_DISABLE_BONJOUR:'1'};
 const receipt={name,phase,head,at:new Date().toISOString(),root,runs:[],observations:[],readback:{}};
 const save=()=>fs.writeFileSync(path.join(root,'receipt.json'),JSON.stringify(receipt,null,2));
 async function command(label, executable, args, options={}){
  const started=performance.now();
  const row=await new Promise((resolve,reject)=>{
   const child=spawn(executable,args,{cwd:checkout,env:{...env,...options.env},stdio:['ignore','pipe','pipe']});
   let stdout='',stderr='';
   const timer=setTimeout(()=>child.kill('SIGKILL'),90000);
   child.stdout.setEncoding('utf8').on('data',x=>{stdout+=x;});
   child.stderr.setEncoding('utf8').on('data',x=>{stderr+=x;});
   child.on('error',reject);
   child.on('close',(code,signal)=>{clearTimeout(timer);resolve({label,args,code,signal,stdout,stderr,seconds:(performance.now()-started)/1000});});
  });
  receipt.runs.push(row);save();
  assert.equal(row.signal,null,`${label}: setup/timeout is not product RED`);
  assert.equal(row.code,options.exit??0,`${label}: ${row.stderr}`);
  return row;
 }
 const run=async(label,args,options)=>command(label,process.execPath,[path.join(checkout,'openclaw.mjs'),...args],options);
 function text(label,output,options={}){
  const controls=[...output.matchAll(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g)].length;
  const forgedLine=output.includes('\noperator-forged');
  const observation={label,controls,forgedLine,escapedLine:output.includes('\\noperator-forged'),unicode:output.includes('café')};
  receipt.observations.push(observation);save();
  assert.equal(controls>0,phase==='red',`${label}: control result`);
  if(!options.table)assert.equal(forgedLine,phase==='red',`${label}: injected report row`);
  assert.equal(observation.unicode,true,`${label}: Unicode control`);
  if(phase==='green')assert.equal(observation.escapedLine,true,`${label}: retain visible escaped line`);
 }
 function finish(){receipt.result='PASS';save();console.log(JSON.stringify({name,phase,head,result:'PASS',receipt:path.join(root,'receipt.json'),observations:receipt.observations,readback:receipt.readback}));}
 return {checkout,root,configPath,config,writeConfig,env,receipt,run,command,text,save,finish,hash:bytes=>createHash('sha256').update(bytes).digest('hex')};
}

proof-storage.mjs:

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import {fixture,unusual} from './proof-common.mjs';
const f=fixture('storage');
const target=path.join(f.root,unusual);
fs.mkdirSync(target);
const marker=Buffer.from('ordinary payload: café\n');
fs.writeFileSync(path.join(target,'keep.txt'),marker);
f.config.storage={locations:{archive:{provider:'filesystem',settings:{path:target},encryption:'none'}}};
f.writeConfig();
const before=fs.readFileSync(f.configPath);
f.text('uninitialized-list',(await f.run('uninitialized-list',['storage','list'])).stdout);
f.text('init',(await f.run('init',['storage','init','archive'])).stdout);
f.text('initialized-list',(await f.run('initialized-list',['storage','list'])).stdout);
const list=JSON.parse((await f.run('json',['storage','list','--json'])).stdout);
assert.equal(list.locations[0].displayTarget,target);
assert.equal(list.locations[0].state,'ok');
const probe=JSON.parse((await f.run('roundtrip',['storage','test','archive','--json'])).stdout);
assert.equal(probe.sizeBytes,256);
assert.equal(probe.state,'ok');
assert.deepEqual(fs.readFileSync(path.join(target,'keep.txt')),marker);
assert.deepEqual(fs.readdirSync(target).sort(),['keep.txt','openclaw-storage.json']);
assert.deepEqual(fs.readFileSync(f.configPath),before);
f.receipt.readback={rawTarget:list.locations[0].displayTarget,state:list.locations[0].state,roundtripBytes:probe.sizeBytes,probeDeleted:true,existingDataUnchanged:true,configUnchanged:true};
f.finish();
{
  "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
      }
    }
  }
}
status: PASS
product_sha: ccb635699023cbf55ee45fe476b99906e63c1050
base_sha: e8b251188f502b088dd037936062a1711ea302e1
claims: C1=Human CLI reports prevent terminal actions and embedded-row injection while preserving raw values.
covered_by: C1=Same normal-built CLI scenario before/after, exact stdout byte checks and scenario-specific external readback described below.
entry: storage list / init / test via normally built openclaw.mjs
owner: src/commands/storage.ts executed unmocked
boundary: subprocess,disk,config-file
readback: Real filesystem provider initialization, JSON target, 256-byte write/read/verify/delete; existing file unchanged and probe absent; configuration bytes unchanged.
proof_command: node proof-storage.mjs "$CHECKOUT" "$PHASE"
harness: proof-common.mjs sha256=8a6d2e48b1b076878e98641b0791f7fb064f44bbff9522fe43d1d34c6ffb007f; proof-storage.mjs sha256=e8032fe021cdbc5d6d2d2f8b91cb8c2e6b1a61538cb26d6670f4ff0258563789
before: RED uninitialized-list: 6 controls; forgedRow=true; escapedNewline=false; init: 3 controls; forgedRow=true; escapedNewline=false; initialized-list: 3 controls; forgedRow=true; escapedNewline=false
after: GREEN uninitialized-list: 0 controls; forgedRow=false; escapedNewline=true; init: 0 controls; forgedRow=false; escapedNewline=true; initialized-list: 0 controls; forgedRow=false; escapedNewline=true
negative_claim: yes
control: Actual 256-byte put/get/delete succeeds; initialization marker retained; existing payload unchanged; Unicode retained; 0 embedded C0/C1 controls in human reports on head.
consumers: Canonical human report owner and related JSON/sibling consumers reviewed; existing terminal-core sanitizer reused. No shared formatter, storage, routing, protocol or endpoint policy change.
tests: OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/program/register.storage.test.ts --maxWorkers=1 => 5 passed (5); exit 0; OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/program/register.storage.test.ts --maxWorkers=1 -t 'escapes terminal controls' => 1 passed | 4 skipped (5); exit 0
tests_changed: yes
test_cost: 360.51 seconds measured native wrapper wall time; 135.71 seconds measured native wrapper wall time; includes native test-worker compilation, module transformation and artifact verification, not only assertions.
visual: no
screenshots: N/A: terminal text output; inspectable JSON-escaped stdout below
published: pr-body
not_tested: Built-in filesystem provider on Linux; no external object-store service, encryption migration or native Windows/macOS claim. Broad upstream CI is pending.
reuse: N/A: fresh native clean CLI build and real scenario on exact product head; full-suite results before final assertion-only fixture edits are labeled separately.

@clawsweeper

clawsweeper Bot commented Oct 25, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: XS labels Oct 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The target changes terminal formatting and prints forged on a separate report line.
  • After: The color sequence is removed and the newline appears as literal \n; JSON retains the original target.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful repair with reusable shipped-CLI evidence, meaningful regression coverage, and no actionable defects.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied prior-head Linux built-CLI traces exercise storage list and init with a real control-bearing filesystem target: controls and forged rows disappear, Unicode and raw JSON survive, and a 256-byte probe completes with existing data and config unchanged; source comparison supports reuse after the equivalent integration simplification, supplemented by reported current-head regression results.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Storage targets and diagnostics containing control characters can change terminal behavior and inject misleading report lines.
Reason: A narrow output-boundary repair protects readable reports without new configuration, restrictions, or competing state.

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
Reviewed head: fa4215237809e8cb0b09c35c9747bbba7f1da4e0

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Storage human reports and raw provider values keeps the original intent (37ffe3c: Named storage locations share a core identity and reporting owner while providers transport objects and describe destinations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced hunks apply the existing sanitizer only to human summaries, diagnostics, and initialization output; structural newlines and JSON branches remain intact. (src/commands/storage.ts:58, fa4215237809)
  • Current main remains affected: Current main directly interpolates provider targets and diagnostics into human output, so this PR still addresses an owned defect. (src/commands/storage.ts:56, 008cf7bc06ab)
  • Real CLI evidence and reuse: The full body supplies Linux built-CLI before/after stdout and filesystem readback on prior head ccb6356. Comparison with the reviewed head verifies equivalent sanitization for those scenarios; the integration removes an intermediate array and unnecessary sanitization of an already-validated name. Supplied body identity: SHA-256 201b2bbe263ea4344131d6af13555c4b6039a1cabd658a7ca5b1802fc7728818. (src/commands/storage.ts:58, fa4215237809)
  • Regression and sanitizer contracts: The added registered-CLI regression uses real filesystem operations, checks sanitized reports and exact JSON targets, and verifies probe cleanup; existing sanitizer tests cover ANSI cursor controls, OSC clipboard payloads, C1 controls, and escaped whitespace. (src/cli/program/register.storage.test.ts:75, fa4215237809)
  • Feature provenance: The verified merged feat: back up to external disks and Cloudflare R2 with storage locations #161913 established named storage locations, provider-owned transport, and core-owned reports; the original commit contains these reporting paths. Rename-following history stopped at unavailable object 8237d6cbcd4eb1ec16e05e1f2086cb3158bdd0bb, while ordinary path history, original source, and current-main blame were readable. (src/commands/storage.ts:56, 37ffe3ce94e2)
  • Proof media scope: All four prepared screenshots were inspected; they show the original Systems backup feature and provide no additional evidence for terminal sanitization.

PR surface

Source +4, Tests +27, Docs +4. Total +35 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 1 27 0 +27
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 37 2 +35

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +6/-2; tests +27 The small production increase reuses the canonical sanitizer, and one integration regression covers unsafe rendering, raw target preservation, and probe cleanup.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Control-bearing storage targets can alter terminal behavior and forge report lines on a limited operator-facing CLI surface.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-25T07:03:31.521Z sha ccb6356 :: needs maintainer review before merge. :: none

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]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit a006151 into openclaw:main Oct 26, 2026
124 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @steipete for reviewing and merging this! I appreciate your help getting this focused fix landed.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
RomneyDa added a commit that referenced this pull request Oct 28, 2026
Co-authored-by: Alix-007 <[email protected]>

(cherry picked from commit a006151)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 9151594fbf7cb4ded45a0765889b294a65cff98c)
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…[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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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.

2 participants