Skip to content

fix(backup): escape terminal controls in schedule and record output - #183357

Closed
Alix-007 wants to merge 423 commits into
openclaw:mainfrom
Alix-007:alix/fix-backup-operations-terminal-controls-20261025
Closed

Alix-007 wants to merge 423 commits into
openclaw:mainfrom
Alix-007:alix/fix-backup-operations-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 in backup schedule acknowledgements and external backup record reports.

User Impact

Operators see readable escaped paths and labels. Scheduled command arguments, stored outcomes, and JSON retain their original values.

Why This Change Was Made

Reuse sanitizeTerminalText at the existing command output owners. The change adds no configuration or backup behavior. Thanks @Alix-007 for the fix and regression coverage.

Evidence

Exact-head CI run 40244519233 passed its test jobs. The required security review remains incomplete: run 40244517298, job 121323208852 failed before reviewing code because GitHub reported 6,415 changed files but returned only 3,000. The local base-to-head diff contains five files. This is a GitHub diff-data blocker, not a completed security assessment; no rerun was requested.

Integrated head: fb914294833c3124f8dd4c752075ad57b13618aa; contributor commits are preserved.

  • Both added command regressions fail on main's original output, then all 31 tests in backup-schedule.test.ts and backup-outcome.test.ts pass with the patch integrated onto main ee6efea4f8c5. Baseline wrapper wall time: 363.17s; initial integrated green: 189.83s; final integrated rerun: 142.51s (Vitest 130.61s). Native worker compilation accounts for most of that cost.
  • Targeted type-aware oxlint, oxfmt, and git diff --check pass. Independent Codex review found no actionable P0–P2 findings.
  • Production +7/−3 (+4), tests +36, docs +5. The simplification pass retained the three direct display conversions; unrelated cleanup would not improve this small repair.
  • Not live-tested independently on the integrated head: a fresh built CLI and isolated Gateway would require new build/setup work. The contributor's inspectable Linux CLI/Gateway traces below are retained at original head b05f793a427ce8a7c8fad6938426a3eee189286c: both acknowledgements lose controls, while cron argv and the backup ledger retain raw values. These are prior-head results.
Captured real CLI proof: base and exact product head

JSON escaping makes control bytes inspectable without executing them. Temporary roots are replaced with $FIXTURE.

{
  "phase": "red",
  "head": "e8b251188f502b088dd037936062a1711ea302e1",
  "at": "2026-10-25T06:06:03.863Z",
  "runs": [
    {
      "label": "schedule",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "enable",
        "--repository",
        "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
        "--every",
        "24h"
      ],
      "code": 0,
      "signal": null,
      "stdout": "Scheduled Git backups enabled: every 24h to $FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G\n",
      "stderr": "",
      "seconds": 2.5134029139999985
    },
    {
      "label": "cron-readback",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "cron",
        "list",
        "--all",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"jobs\": [\n    {\n      \"id\": \"241eda10-ddf6-42cf-9b81-94886dd69b0c\",\n      \"declarationKey\": \"openclaw-backup-scheduled\",\n      \"name\": \"openclaw-backup-scheduled\",\n      \"enabled\": true,\n      \"createdAtMs\": 1792908387769,\n      \"schedule\": {\n        \"kind\": \"every\",\n        \"everyMs\": 86400000,\n        \"anchorMs\": 1792908387769\n      },\n      \"sessionTarget\": \"isolated\",\n      \"wakeMode\": \"now\",\n      \"payload\": {\n        \"kind\": \"command\",\n        \"argv\": [\n          \"openclaw\",\n          \"backup\",\n          \"git\",\n          \"create\",\n          \"--repository\",\n          \"$FIXTURE/café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n          \"--all\"\n        ]\n      },\n      \"delivery\": {\n        \"mode\": \"none\"\n      },\n      \"state\": {\n        \"nextRunAtMs\": 1792994787769\n      },\n      \"updatedAtMs\": 1792908387769,\n      \"configRevision\": \"sha256:uT-wg9uZwRWsgU6Qmn9ecAIkZ-q1hOHwBUh-SETOI1o\",\n      \"nextRunAtMs\": 1792994787769,\n      \"effectiveAgentId\": \"main\",\n      \"status\": \"idle\"\n    }\n  ],\n  \"snapshotRevision\": \"sha256:VSy9gSaUpIOOQ7vycTlo4QCPwgClfCxkE8hkVU_gMpk\",\n  \"total\": 1,\n  \"offset\": 0,\n  \"limit\": 200,\n  \"hasMore\": false,\n  \"nextOffset\": null,\n  \"deliveryPreviews\": {\n    \"241eda10-ddf6-42cf-9b81-94886dd69b0c\": {\n      \"label\": \"not requested\",\n      \"detail\": \"not requested\"\n    }\n  }\n}\n",
      "stderr": "",
      "seconds": 1.8147186449999972
    },
    {
      "label": "record",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "record",
        "--target",
        "café\^[[31m\noperator-forged\tend\rrow\^G",
        "--status",
        "ok",
        "--bytes",
        "42"
      ],
      "code": 0,
      "signal": null,
      "stdout": "External backup: café\^[[31m\noperator-forged\tend\rrow\^G (ok)\n",
      "stderr": "",
      "seconds": 2.2432804529999992
    },
    {
      "label": "ordinary-control",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "record",
        "--target",
        "ordinary",
        "--status",
        "ok",
        "--bytes",
        "256",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"kind\": \"external\",\n  \"archivePath\": \"ordinary\",\n  \"target\": \"ordinary\",\n  \"status\": \"ok\",\n  \"bytes\": 256\n}\n",
      "stderr": "",
      "seconds": 2.157258431000002
    },
    {
      "label": "ledger-readback",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "gateway",
        "call",
        "backup.status",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"targets\": [\n    {\n      \"kind\": \"external\",\n      \"target\": \"ordinary\",\n      \"latest\": {\n        \"id\": \"0042a5f3-5a4a-404d-81ec-c9b22c779a09\",\n        \"createdAt\": 1792908393873,\n        \"archivePath\": \"ordinary\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"ordinary\",\n        \"bytes\": 256\n      },\n      \"latestOk\": {\n        \"id\": \"0042a5f3-5a4a-404d-81ec-c9b22c779a09\",\n        \"createdAt\": 1792908393873,\n        \"archivePath\": \"ordinary\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"ordinary\",\n        \"bytes\": 256\n      }\n    },\n    {\n      \"kind\": \"external\",\n      \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n      \"latest\": {\n        \"id\": \"cf30c99f-4559-4c48-809e-63136ec3238c\",\n        \"createdAt\": 1792908391682,\n        \"archivePath\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"bytes\": 42\n      },\n      \"latestOk\": {\n        \"id\": \"cf30c99f-4559-4c48-809e-63136ec3238c\",\n        \"createdAt\": 1792908391682,\n        \"archivePath\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"bytes\": 42\n      }\n    }\n  ],\n  \"schedules\": [\n    {\n      \"id\": \"241eda10-ddf6-42cf-9b81-94886dd69b0c\",\n      \"mode\": \"git\",\n      \"target\": \"$FIXTURE/café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n      \"enabled\": true,\n      \"everyMs\": 86400000,\n      \"nextRunAtMs\": 1792994787769\n    }\n  ],\n  \"locations\": []\n}\n",
      "stderr": "",
      "seconds": 1.6661163239999988
    },
    {
      "label": "disable",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "disable",
        "--git"
      ],
      "code": 0,
      "signal": null,
      "stdout": "Scheduled Git backups disabled.\n",
      "stderr": "",
      "seconds": 2.3022968919999984
    },
    {
      "label": "cron-cleanup",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "cron",
        "list",
        "--all",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"jobs\": [],\n  \"snapshotRevision\": \"sha256:T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU\",\n  \"total\": 0,\n  \"offset\": 0,\n  \"limit\": 200,\n  \"hasMore\": false,\n  \"nextOffset\": null,\n  \"deliveryPreviews\": {}\n}\n",
      "stderr": "",
      "seconds": 1.7800103469999957
    }
  ],
  "observations": [
    {
      "label": "schedule",
      "controls": 3,
      "forgedLine": true,
      "escapedLine": false,
      "unicode": true
    },
    {
      "label": "record",
      "controls": 3,
      "forgedLine": true,
      "escapedLine": false,
      "unicode": true
    }
  ],
  "readback": {
    "rawRepository": "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
    "storedCronArgv": [
      "openclaw",
      "backup",
      "git",
      "create",
      "--repository",
      "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
      "--all"
    ],
    "backupTargets": [
      {
        "kind": "external",
        "target": "ordinary",
        "latest": {
          "id": "0042a5f3-5a4a-404d-81ec-c9b22c779a09",
          "createdAt": 1792908393873,
          "archivePath": "ordinary",
          "status": "ok",
          "kind": "external",
          "target": "ordinary",
          "bytes": 256
        },
        "latestOk": {
          "id": "0042a5f3-5a4a-404d-81ec-c9b22c779a09",
          "createdAt": 1792908393873,
          "archivePath": "ordinary",
          "status": "ok",
          "kind": "external",
          "target": "ordinary",
          "bytes": 256
        }
      },
      {
        "kind": "external",
        "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
        "latest": {
          "id": "cf30c99f-4559-4c48-809e-63136ec3238c",
          "createdAt": 1792908391682,
          "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "status": "ok",
          "kind": "external",
          "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "bytes": 42
        },
        "latestOk": {
          "id": "cf30c99f-4559-4c48-809e-63136ec3238c",
          "createdAt": 1792908391682,
          "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "status": "ok",
          "kind": "external",
          "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "bytes": 42
        }
      }
    ],
    "ordinaryRecordPresent": true,
    "scheduleRemoved": true,
    "actualGatewayReady": true
  },
  "cleanup": {
    "gatewayJoined": true,
    "productionTouched": false
  },
  "result": "PASS"
}
{
  "phase": "green",
  "head": "b05f793a427ce8a7c8fad6938426a3eee189286c",
  "at": "2026-10-25T06:38:20.141Z",
  "runs": [
    {
      "label": "schedule",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "enable",
        "--repository",
        "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
        "--every",
        "24h"
      ],
      "code": 0,
      "signal": null,
      "stdout": "Scheduled Git backups enabled: every 24h to $FIXTURE/café\\noperator-forged\\tend\\rrow\n",
      "stderr": "",
      "seconds": 2.744020289
    },
    {
      "label": "cron-readback",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "cron",
        "list",
        "--all",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"jobs\": [\n    {\n      \"id\": \"532580b5-bd02-4a74-987f-dff1d7589db4\",\n      \"declarationKey\": \"openclaw-backup-scheduled\",\n      \"name\": \"openclaw-backup-scheduled\",\n      \"enabled\": true,\n      \"createdAtMs\": 1792910322719,\n      \"schedule\": {\n        \"kind\": \"every\",\n        \"everyMs\": 86400000,\n        \"anchorMs\": 1792910322719\n      },\n      \"sessionTarget\": \"isolated\",\n      \"wakeMode\": \"now\",\n      \"payload\": {\n        \"kind\": \"command\",\n        \"argv\": [\n          \"openclaw\",\n          \"backup\",\n          \"git\",\n          \"create\",\n          \"--repository\",\n          \"$FIXTURE/café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n          \"--all\"\n        ]\n      },\n      \"delivery\": {\n        \"mode\": \"none\"\n      },\n      \"state\": {\n        \"nextRunAtMs\": 1792996722719\n      },\n      \"updatedAtMs\": 1792910322719,\n      \"configRevision\": \"sha256:axzYXbbOfR7btJvc2GBUiSb7tiUSbw2_5zLVrdihPxE\",\n      \"nextRunAtMs\": 1792996722719,\n      \"effectiveAgentId\": \"main\",\n      \"status\": \"idle\"\n    }\n  ],\n  \"snapshotRevision\": \"sha256:BUy6VMvpTl5f7iyUInZ24g0wC8M_ckb8JgUFRUGsLc0\",\n  \"total\": 1,\n  \"offset\": 0,\n  \"limit\": 200,\n  \"hasMore\": false,\n  \"nextOffset\": null,\n  \"deliveryPreviews\": {\n    \"532580b5-bd02-4a74-987f-dff1d7589db4\": {\n      \"label\": \"not requested\",\n      \"detail\": \"not requested\"\n    }\n  }\n}\n",
      "stderr": "",
      "seconds": 2.3244784270000016
    },
    {
      "label": "record",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "record",
        "--target",
        "café\^[[31m\noperator-forged\tend\rrow\^G",
        "--status",
        "ok",
        "--bytes",
        "42"
      ],
      "code": 0,
      "signal": null,
      "stdout": "External backup: café\\noperator-forged\\tend\\rrow (ok)\n",
      "stderr": "",
      "seconds": 2.813386662000001
    },
    {
      "label": "ordinary-control",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "record",
        "--target",
        "ordinary",
        "--status",
        "ok",
        "--bytes",
        "256",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"kind\": \"external\",\n  \"archivePath\": \"ordinary\",\n  \"target\": \"ordinary\",\n  \"status\": \"ok\",\n  \"bytes\": 256\n}\n",
      "stderr": "",
      "seconds": 2.802676024
    },
    {
      "label": "ledger-readback",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "gateway",
        "call",
        "backup.status",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"targets\": [\n    {\n      \"kind\": \"external\",\n      \"target\": \"ordinary\",\n      \"latest\": {\n        \"id\": \"7fa27059-3980-4e48-859f-8fe54b240ae5\",\n        \"createdAt\": 1792910330488,\n        \"archivePath\": \"ordinary\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"ordinary\",\n        \"bytes\": 256\n      },\n      \"latestOk\": {\n        \"id\": \"7fa27059-3980-4e48-859f-8fe54b240ae5\",\n        \"createdAt\": 1792910330488,\n        \"archivePath\": \"ordinary\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"ordinary\",\n        \"bytes\": 256\n      }\n    },\n    {\n      \"kind\": \"external\",\n      \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n      \"latest\": {\n        \"id\": \"f6190e08-c88f-48b5-99e3-3bc2d2eea667\",\n        \"createdAt\": 1792910327716,\n        \"archivePath\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"bytes\": 42\n      },\n      \"latestOk\": {\n        \"id\": \"f6190e08-c88f-48b5-99e3-3bc2d2eea667\",\n        \"createdAt\": 1792910327716,\n        \"archivePath\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"status\": \"ok\",\n        \"kind\": \"external\",\n        \"target\": \"café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n        \"bytes\": 42\n      }\n    }\n  ],\n  \"schedules\": [\n    {\n      \"id\": \"532580b5-bd02-4a74-987f-dff1d7589db4\",\n      \"mode\": \"git\",\n      \"target\": \"$FIXTURE/café\\^[[31m\\noperator-forged\\tend\\rrow\\^G\",\n      \"enabled\": true,\n      \"everyMs\": 86400000,\n      \"nextRunAtMs\": 1792996722719\n    }\n  ],\n  \"locations\": []\n}\n",
      "stderr": "",
      "seconds": 2.0335354959999967
    },
    {
      "label": "disable",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "backup",
        "disable",
        "--git"
      ],
      "code": 0,
      "signal": null,
      "stdout": "Scheduled Git backups disabled.\n",
      "stderr": "",
      "seconds": 3.0912175809999973
    },
    {
      "label": "cron-cleanup",
      "args": [
        "$CHECKOUT/openclaw.mjs",
        "cron",
        "list",
        "--all",
        "--json"
      ],
      "code": 0,
      "signal": null,
      "stdout": "{\n  \"jobs\": [],\n  \"snapshotRevision\": \"sha256:T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU\",\n  \"total\": 0,\n  \"offset\": 0,\n  \"limit\": 200,\n  \"hasMore\": false,\n  \"nextOffset\": null,\n  \"deliveryPreviews\": {}\n}\n",
      "stderr": "",
      "seconds": 2.0019669499999946
    }
  ],
  "observations": [
    {
      "label": "schedule",
      "controls": 0,
      "forgedLine": false,
      "escapedLine": true,
      "unicode": true
    },
    {
      "label": "record",
      "controls": 0,
      "forgedLine": false,
      "escapedLine": true,
      "unicode": true
    }
  ],
  "readback": {
    "rawRepository": "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
    "storedCronArgv": [
      "openclaw",
      "backup",
      "git",
      "create",
      "--repository",
      "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
      "--all"
    ],
    "backupTargets": [
      {
        "kind": "external",
        "target": "ordinary",
        "latest": {
          "id": "7fa27059-3980-4e48-859f-8fe54b240ae5",
          "createdAt": 1792910330488,
          "archivePath": "ordinary",
          "status": "ok",
          "kind": "external",
          "target": "ordinary",
          "bytes": 256
        },
        "latestOk": {
          "id": "7fa27059-3980-4e48-859f-8fe54b240ae5",
          "createdAt": 1792910330488,
          "archivePath": "ordinary",
          "status": "ok",
          "kind": "external",
          "target": "ordinary",
          "bytes": 256
        }
      },
      {
        "kind": "external",
        "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
        "latest": {
          "id": "f6190e08-c88f-48b5-99e3-3bc2d2eea667",
          "createdAt": 1792910327716,
          "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "status": "ok",
          "kind": "external",
          "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "bytes": 42
        },
        "latestOk": {
          "id": "f6190e08-c88f-48b5-99e3-3bc2d2eea667",
          "createdAt": 1792910327716,
          "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "status": "ok",
          "kind": "external",
          "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
          "bytes": 42
        }
      }
    ],
    "ordinaryRecordPresent": true,
    "scheduleRemoved": true,
    "actualGatewayReady": true
  },
  "cleanup": {
    "gatewayJoined": true,
    "productionTouched": false
  },
  "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-backup-ops.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-backup-ops.mjs:

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
import {spawn} from 'node:child_process';
import {setTimeout as delay} from 'node:timers/promises';
import {fixture,unusual} from './proof-common.mjs';
const f=fixture('backup-ops');
const reserved=net.createServer();await new Promise(resolve=>reserved.listen(0,'127.0.0.1',resolve));
const port=reserved.address().port;await new Promise(resolve=>reserved.close(resolve));
f.config.gateway={mode:'local',bind:'loopback',port,auth:{mode:'token',token:'synthetic-isolated-escape-proof'},controlUi:{enabled:false}};
f.config.cron={enabled:false};f.writeConfig();
f.env.OPENCLAW_GATEWAY_TOKEN='synthetic-isolated-escape-proof';f.env.OPENCLAW_SKIP_CHANNELS='1';
const out=fs.openSync(path.join(f.root,'gateway.stdout'),'w',0o600),err=fs.openSync(path.join(f.root,'gateway.stderr'),'w',0o600);
const gateway=spawn(process.execPath,[path.join(f.checkout,'openclaw.mjs'),'gateway','run','--port',String(port),'--bind','loopback'],{cwd:f.checkout,env:f.env,detached:true,stdio:['ignore',out,err]});fs.closeSync(out);fs.closeSync(err);
let terminal;gateway.once('close',(code,signal)=>{terminal={code,signal};});gateway.once('error',error=>{terminal={error:String(error)};});
try {
 const deadline=Date.now()+90000;
 for(;;){assert.equal(terminal,undefined,'Gateway startup failed');try{if((await fetch(`http://127.0.0.1:${port}/readyz`,{signal:AbortSignal.timeout(1500)})).status===200)break;}catch{}assert.ok(Date.now()<deadline,'Gateway readiness timeout');await delay(1000);}
 const repository=path.join(f.root,unusual);
 f.text('schedule',(await f.run('schedule',['backup','enable','--repository',repository,'--every','24h'])).stdout);
 const jobs=JSON.parse((await f.run('cron-readback',['cron','list','--all','--json'])).stdout);
 assert.equal(jobs.jobs.length,1);
 assert.ok(jobs.jobs[0].payload.argv.includes(repository));
 f.text('record',(await f.run('record',['backup','record','--target',unusual,'--status','ok','--bytes','42'])).stdout);
 await f.run('ordinary-control',['backup','record','--target','ordinary','--status','ok','--bytes','256','--json']);
 const status=JSON.parse((await f.run('ledger-readback',['gateway','call','backup.status','--json'])).stdout);
 assert.ok(status.targets.some(row=>row.target===unusual));
 assert.ok(status.targets.some(row=>row.target==='ordinary'));
 await f.run('disable',['backup','disable','--git']);
 const empty=JSON.parse((await f.run('cron-cleanup',['cron','list','--all','--json'])).stdout);assert.equal(empty.jobs.length,0);
 f.receipt.readback={rawRepository:repository,storedCronArgv:jobs.jobs[0].payload.argv,backupTargets:status.targets,ordinaryRecordPresent:true,scheduleRemoved:true,actualGatewayReady:true};
 f.receipt.result='PASS';
} catch(error){f.receipt.result='FAIL';f.receipt.error=String(error);throw error;}
finally {
 if(!terminal){try{process.kill(-gateway.pid,'SIGTERM');}catch(error){if(error.code!=='ESRCH')throw error;}for(let i=0;i<20&&!terminal;i++)await delay(500);}
 if(!terminal){try{process.kill(-gateway.pid,'SIGKILL');}catch(error){if(error.code!=='ESRCH')throw error;}for(let i=0;i<10&&!terminal;i++)await delay(500);}
 f.receipt.cleanup={gatewayJoined:!!terminal,productionTouched:false};f.save();
}
assert.equal(f.receipt.result,'PASS');assert.equal(f.receipt.cleanup.gatewayJoined,true);f.finish();
{
  "focusedChecks": [
    {
      "log": "backup-ops-tests-green.log",
      "seconds": 749.32,
      "tests": "31 passed (31)",
      "command": "OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/commands/backup-schedule.test.ts src/commands/backup-outcome.test.ts --maxWorkers=1"
    }
  ],
  "independentReview": {
    "sourceVerdict": "pass",
    "findings": [],
    "scope": [
      "Complete base-to-candidate production/test/documentation diff",
      "backupEnableCommand and backupRecordCommand full modules",
      "CLI registration callers, disable sibling, cron command builder and outcome persistence owner",
      "ANSI/C0/C1 sanitization owner, human/JSON branches, raw cron argv and ledger target preservation",
      "Regression tests at command boundary and actual baseline RED proof harness/receipt summaries"
    ],
    "hashes": {
      "src/commands/backup-schedule.ts": "b0c08494de31e414541d551d119805a73a5d75622c5fd909d84092b312e64d66",
      "src/commands/backup-record.ts": "cf85e6abad84f89d1bf01a1ec4bcbb344507bc03dca97b37a3611103b33f26ae",
      "src/commands/backup-schedule.test.ts": "c26f3490427829afcfa83de02695937cb36988017aa9e18986662f4489828c32",
      "src/commands/backup-outcome.test.ts": "daa2fa939731fb92e9109264186c3ef5f36d114966107c61a97ca283f02e0a62",
      "docs/cli/backup.md": "f3971829463f031496a85f401e9b547017282aff50245d44a6ce74888ecc3723"
    },
    "staticGates": {
      "diffCheck": "pass",
      "targetedTypecheck": "pass exit 0: OPENCLAW_TYPECHECKER=tsgo repository run-tsgo.mjs -p ../backup-ops-review-types.json --declaration false --singleThreaded --checkers 1, only two touched test roots plus canonical ambient declarations; see backup-ops-independent-typecheck.log",
      "targetedLint": "pass exit 0: final normal type-aware repository run-oxlint.mjs with config/tsconfig/oxlint.core.json on all four changed TypeScript files; normal dist lock queue honored; see backup-ops-independent-lint-final.log. Prior120s queue-only attempt retained as non-pass history",
      "targetedFormat": "pass exit 0: OPENCLAW_FORMAT_TOOL=oxfmt repository run-format.mts --check all five changed files; see backup-ops-independent-format.log"
    },
    "exactHeadProof": {
      "status": "PASS",
      "productHead": "b05f793a427ce8a7c8fad6938426a3eee189286c",
      "observations": [
        {
          "label": "schedule",
          "controls": 0,
          "forgedLine": false,
          "escapedLine": true,
          "unicode": true
        },
        {
          "label": "record",
          "controls": 0,
          "forgedLine": false,
          "escapedLine": true,
          "unicode": true
        }
      ],
      "readback": {
        "rawRepository": "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
        "storedCronArgv": [
          "openclaw",
          "backup",
          "git",
          "create",
          "--repository",
          "$FIXTURE/café\^[[31m\noperator-forged\tend\rrow\^G",
          "--all"
        ],
        "backupTargets": [
          {
            "kind": "external",
            "target": "ordinary",
            "latest": {
              "id": "7fa27059-3980-4e48-859f-8fe54b240ae5",
              "createdAt": 1792910330488,
              "archivePath": "ordinary",
              "status": "ok",
              "kind": "external",
              "target": "ordinary",
              "bytes": 256
            },
            "latestOk": {
              "id": "7fa27059-3980-4e48-859f-8fe54b240ae5",
              "createdAt": 1792910330488,
              "archivePath": "ordinary",
              "status": "ok",
              "kind": "external",
              "target": "ordinary",
              "bytes": 256
            }
          },
          {
            "kind": "external",
            "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
            "latest": {
              "id": "f6190e08-c88f-48b5-99e3-3bc2d2eea667",
              "createdAt": 1792910327716,
              "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
              "status": "ok",
              "kind": "external",
              "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
              "bytes": 42
            },
            "latestOk": {
              "id": "f6190e08-c88f-48b5-99e3-3bc2d2eea667",
              "createdAt": 1792910327716,
              "archivePath": "café\^[[31m\noperator-forged\tend\rrow\^G",
              "status": "ok",
              "kind": "external",
              "target": "café\^[[31m\noperator-forged\tend\rrow\^G",
              "bytes": 42
            }
          }
        ],
        "ordinaryRecordPresent": true,
        "scheduleRemoved": true,
        "actualGatewayReady": true
      },
      "cleanup": {
        "gatewayJoined": true,
        "productionTouched": false
      }
    }
  }
}
status: PASS
product_sha: b05f793a427ce8a7c8fad6938426a3eee189286c
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: backup enable / record via normally built openclaw.mjs
owner: src/commands/backup-schedule.ts, src/commands/backup-record.ts executed unmocked
boundary: subprocess,websocket,sqlite
readback: Actual isolated authenticated loopback Gateway: cron list retains exact repository argv; backup.status reads both raw label and ordinary label from ledger; disabling removes 1 schedule.
proof_command: node proof-backup-ops.mjs "$CHECKOUT" "$PHASE"
harness: proof-common.mjs sha256=8a6d2e48b1b076878e98641b0791f7fb064f44bbff9522fe43d1d34c6ffb007f; proof-backup-ops.mjs sha256=035bfebe3dbed8381a10903c380eb05d5f4b267b7348c58f9dbfc15a024ab88f
before: RED schedule: 3 controls; forgedRow=true; escapedNewline=false; record: 3 controls; forgedRow=true; escapedNewline=false
after: GREEN schedule: 0 controls; forgedRow=false; escapedNewline=true; record: 0 controls; forgedRow=false; escapedNewline=true
negative_claim: yes
control: Actual Gateway readiness 200; ordinary record persists 256 bytes while unusual label persists 42 bytes; 1 schedule added then 0 remain; 0 embedded C0/C1 controls in head acknowledgements.
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/commands/backup-schedule.test.ts src/commands/backup-outcome.test.ts --maxWorkers=1 => 31 passed (31); exit 0
tests_changed: yes
test_cost: 749.32 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: Isolated Linux Gateway and local outcome ledger; scheduled backup execution, remote Git push and production Gateway/channels are not exercised. 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 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 backup schedule acknowledgements, missing-remote guidance, and external backup record output.

Example: Run backup record with target "café\u001b[31m\nforged\tend\rrow\u0007".

  • Before: The acknowledgement emits ANSI and control characters, allowing a forged report row.
  • After: The acknowledgement displays "café\nforged\tend\rrow" while persistence and JSON retain the original target.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused reuse of the canonical sanitizer, meaningful output-and-preservation regressions, and inspected shipped CLI proof support merging after normal CI completes.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Inspected supplied Linux CLI traces and scripts for base e8b2511 and exact head b05f793: normally built backup enable and record commands run against an isolated authenticated Gateway, corrected acknowledgements contain no embedded controls, and cron/ledger readback retains raw values; scheduled execution and remote push are outside the changed display behavior.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Backup acknowledgements can execute terminal controls or display forged rows from repository paths and external target labels.
Reason: The patch extends an existing terminal display policy to omitted output sites without adding configuration, restrictions, or another owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current terminal-output defect with a focused patch and no actionable findings.

Priority: P2
Reviewed head: b05f793a427ce8a7c8fad6938426a3eee189286c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Backup CLI commands accept repository paths and target labels, submit schedules or record outcomes through existing owners, and render human-readable acknowledgements.

flowchart TD
  A[Backup CLI arguments] --> B[Schedule and record commands]
  B --> C[Gateway cron owner]
  B --> D[Backup outcome ledger]
  B --> E[Existing terminal sanitizer]
  E --> F[Human terminal output]
  B --> G[Raw JSON output]
Loading

Technical review

Best possible solution:

Merge the existing display-only repair once the normal exact-head checks pass.

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

Current-main source directly emits control-bearing values, and supplied base/head CLI traces demonstrate the failure and correction; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete fix: reuse the existing sanitizer at output owners while preserving operational inputs and machine-readable values.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 128f7124191f.

Provenance checked

  • Backup schedule acknowledgements and missing-origin guidance keeps the original intent (37b4fc8: Scheduling provisions an idempotent Gateway job; origin preflight prevents unattended schedules from repeatedly producing degraded pushes, and the storage-location feature later expanded its destination reporting.)
  • External backup record acknowledgement keeps the original intent (37ffe3c: External jobs contribute outcomes to the existing backup ledger while keeping their execution owner; this patch preserves recording and changes only terminal presentation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still contains the defect: Current main interpolates the raw target into record output and the raw destination into schedule output; both production files are unchanged from the PR merge base. (src/commands/backup-record.ts:41, 128f7124191f)
  • Minimal display-boundary repair: The introduced hunks reuse sanitizeTerminalText only at human output sites, leaving schedule construction, outcome persistence, and JSON branches intact. (src/commands/backup-schedule.ts:187, b05f793a427c)
  • Supplied shipped CLI proof inspected: The full PR body contains base/head CLI stdout and replay scripts using a normally built CLI and isolated authenticated Gateway; head output removes controls while cron and ledger readback preserve raw values. Captured body source identity: 8e55602f8dde2ac40745a45b9e96b8d3e6f7a680f19286b8cbd2dedc2bd3d905. (b05f793a427c)
  • Existing terminal policy: The existing sanitizer strips ANSI sequences, escapes newline/tab/carriage return, and removes remaining C0/C1 controls; its tests include cursor manipulation and OSC clipboard payloads. (packages/terminal-core/src/safe-text.ts:11, b05f793a427c)
  • Feature history and ownership: History traces scheduling to the recorded-backup feature and offsite/record behavior to the storage-location feature, with subsequent validation and custody repairs. A missing historical blob limited sibling backup-git.ts blame; the changed-file history and ownership lines were readable. (src/commands/backup-schedule.ts:176, 37ffe3ce94e2)
  • Related merged fix covers a different surface: fix(backup): escape terminal controls in Git backup reports #181586 merged Git-report sanitization and the shared ledger-warning repair; it does not sanitize schedule acknowledgements or external record labels. (src/commands/backup-git.ts, 3d1956124001)

Likely related people:

  • Peter Steinberger: Raw commit 37ffe3c adds src/commands/backup-schedule.ts:169 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 37ffe3ce94e2; files: src/commands/backup-schedule.ts)
  • YangManBOBO: Raw commit 2450ae0 adds src/commands/backup-record.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2450ae0b6aa7; files: src/commands/backup-record.ts)

PR surface

Source +4, Tests +36, Docs +5. Total +45 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 7 3 +4
Tests 2 36 0 +36
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 48 3 +45

Labels

Label changes:

  • add P2: Control-bearing backup paths or labels can corrupt operator reports, with limited scope and a focused repair.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Control-bearing backup paths or labels can corrupt operator reports, with limited scope and a focused repair.
  • 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.

Reviewed October 25, 2026, 3:01 AM ET / 07:01 UTC.

steipete and others added 20 commits October 25, 2026 04:30
…aw#183539)

* fix(diagnostics): profile the captured main-thread stall interval

* fix(diagnostics): detach stall heartbeat from request context
…limit (openclaw#183378)

* perf(sessions): skip cold envelopes for transcripts over the archive limit

Cold storage learned that a transcript exceeds the 64 MiB uncompressed
archive limit only after building its whole envelope inside a read
snapshot, then ended the batch. On Team, 50 windows (6.15 GiB) are over
the limit; their snapshot reads took a median 3.2 s and up to 106 s, and
the in-memory cooldown resets on every deploy, so each restart re-read
them.

Selection now sums the original event bytes through the session index
and classifies those windows as oversized before any envelope work; later
candidates in the same pass still archive. The warning names the session
and the lower-bound bytes.

* fix(sessions): bound UTF-16 stores by UTF-8 bytes in the cold pre-check

UTF-16 SQLite stores leave event_utf8_bytes null, and octet_length counts
stored UTF-16 bytes, so the pre-check could mark an archivable transcript
oversized and park it on cooldown. Sum exact UTF-8 bytes where known and
halve unknown stored bytes on UTF-16 stores, as sqlite-jsonl-budget does.
…3549)

Reuse the fresh reflected descriptor instead of constructing two temporary descriptors per bound tool property. Preserve callable/accessor admission, receiver binding, mutable host definitions and lifecycle authority. Six paired owner runs reduce binding-file sampled allocation by 37.52% and total allocation by 2.64%; CPU and latency means are neutral. Existing focused contracts: 110 tests passed.
* perf: reduce first-route loading work

* perf: record measured route-readiness byte tradeoff

* test(ui): await lazy views in route readiness coverage

* test(ui): remove redundant intent call-shape coverage

* test(ui): preserve owner-only cron settlement timing

* test(ui): prepare runtime before streaming mutation checks

* perf: refresh measured route startup baseline

* refactor(ui): keep settings renderer private to its route

* test(ui): prepare structured media fixtures before cases

* fix(ui): retire inactive Memory settings presentations

Use the admitted route to end inactive plugin presentation scopes while rendering is retained. Keep abort-owned asset disposal and fence callbacks against the same live scope. Align the service-worker production fixture setup with the shared E2E hook budget.

* chore(ui): record merged route readiness baseline
fix(wiki): reject a FIFO passed to wiki apply synthesis --body-file instead of hanging

`openclaw wiki apply synthesis --body-file` hung forever when given a named pipe with no writer, or a symlink to one, because opening it blocked before the command could check that the body is a regular file. The command now checks the path first and exits 1 with regular-file guidance (also in JSON output), leaving the wiki unchanged.

Evidence: built CLI with a real FIFO from mkfifo. On main a FIFO and a symlink to it both blocked until an external 7 s timeout (twice each); with this change both exit 1 right away with the guidance (twice each), and the vault files are byte-identical. An inline body, a regular file, a symlink to a regular file and a body over 1 MiB are still applied in full. Production +15/-1.

Thanks @Leon-SK668.

Co-authored-by: Ayaan Zaidi <[email protected]>
…on (openclaw#183542)

* perf(agents): reuse frozen tool result hashes across prompt preparation

* test(agents): compare recorded hashes without unchecked indexing
Keep the standalone transcript worker isolated from the Gateway server graph while preserving native-worker recovery ownership and lifecycle behavior.
* test(infra): minimize s0305 fixtures and assertions

Type triage inputs as failure artifacts instead of full updater results, removing unused plugin metadata. Consolidate handoff payload and recovery assertions while retaining error outcomes, private permissions, descendant cleanup, and recovery ordering.

Use the credential operation producer for fixture rows, reuse exception capture, minimize the symlink-refusal database, and scope snapshot spy disposal. Keep snapshot callback coverage in the late-registration test and exact restoration diagnostics in handoff result tests. Preserve all test cases and native-execution guards.

CI-only static validation: oxfmt, plain oxlint and git diff --check passed. No tests or builds run. Cumulative line target remains unmet; retained legacy rollback and Unicode custody cases have distinct regression boundaries.

* test(gateway): deslop s0307 tests

Consolidate avatar retry setup, OAuth transport fixtures, setup settlement observation, narration projections, and scoped sharing spy cleanup. Preserve all cases and distinct auth, recovery, privacy, and ordering assertions.

CI-only shard: plain oxlint, oxfmt, and diff-check pass. No test or coverage execution. Dense retained boundaries prevent the 25 percent line target; total 4444 to 4393 lines.

* test(gateway): remove duplicate s0307 proof layers

Delete the matching lifecycle block copied verbatim into cron-stream-output.interleavings.test.ts. cron-stream-matching.test.ts retains long-line delivery, matcher timeout, disable accounting, cancellation joining, and dropped-prefix cases.

Keep hardlink rejection in control-ui.http.test.ts, malformed route variants in control-ui-contract.test.ts, and identity precedence in assistant-identity.test.ts. Consolidate Tailscale exit assertions into its recovery case and retain separate Serve/Funnel branch rows. Replace repeated abort fixture teardown with owner disposal and remove repeated sharing guard assertions.

CI-only: plain oxlint, oxfmt, and diff-check pass; no test or build execution. Additional reduction 4393 to 4195 lines; original shard 4444 to 4195. Remaining distinct boundary and interleaving proof prevents the 25 percent target.

* test(gateway): consolidate s0307 fixture layers

Table avatar projection outcomes without dropping branches. Keep one animated WebP pass-through case while the APNG data case retains decoder-to-animation coverage. Replace custom socket capture with the standard stream consumer; retain deadline, rejection, graceful EOF, and exact wire assertions.

Fold the standalone alias worker-grant case into the stronger alias grant-revocation lifecycle row. Preserve release custody and all distinct authority assertions.

CI-only static gates: plain oxlint, oxfmt, and diff-check pass. No test or build runs. Additional 4195 to 4124 lines; cumulative 4444 to 4124 (7.2 percent), short of the 25 percent target because further whole-case cuts lack equivalent boundary proof.

* test(matrix): deslop s0308 tests

Consolidate repeated approval fixtures, trace steps, action options and account configuration while preserving all expanded cases. Exact FIFO request order retains the removed count assertions; exact inspect event order retains duplicate lifecycle call assertions. CI-only validation: formatting, plain oxlint and diff-check; runtime proof deferred to hosted CI. Reduction is 263 of 4235 lines (6.2%); distinct authority, lifecycle, routing and persistence coverage prevents an honest 25% cut.

* test(state): deslop s0309 tests

Remove duplicate v22 cursor/resume and repair cases from the v21 suite; openclaw-state-db-schema-v22-columns.test.ts retains the same local schema, identity, backup, runtime/Doctor and repair assertions. openclaw-state-db-task-index-migration.test.ts retains the duplicated v22/v23 task-index migration, cron upsert and publication rollback cases.

Keep failed-preparation custody proof in openclaw-state-db-readonly.retained.test.ts, which exercises the real reader transport through a mocked worker pool. Consolidate historical JSON extraction fixtures without changing their SQL tokens. No production changes; no test cases folded.

CI-only validation: targeted oxfmt, plain oxlint and git diff --check passed; static historical SQL comparison matched. Tests and coverage were not run per campaign instruction. The remaining authority, corruption, migration and lifecycle cases have distinct boundaries, so the shard stops below the 25 percent LOC target.

* test(state): trim redundant s0309 coverage

Retain seal mismatch proof in openclaw-agent-db.integrity-cache.test.ts (reports the next admission clean-close outcome), and lazy snapshot identity/lifecycle proof in openclaw-state-db-readonly.snapshot-admission.test.ts (lets a sync reader join the same lazy preparation started by an async reader). Remove the plural lease adapter wiring replay; group grant, custody and settlement tests remain.

Consolidate background preference presentation and selection rows. Keep warm-feature transaction checks in the durable-installation test; remove per-feature replays of schema-ensure warm paths. Real secret creation remains in secret-store.test.ts, and promoted-column behavior remains in transcripts/store.test.ts and delivery-queue owner tests. Replace cleanup-ID SQL logging with direct worker result assertions, retaining malformed-path and no-host-SQL proof.

Drop repeated historical INSERT column inventories only after statically verifying identical table-column order. No production changes or test runs; targeted oxfmt, plain oxlint and diff check passed. This second cut removes 295 more lines; cumulative 5012 to 4106 remains below the requested 25 percent because further identified cuts would remove distinct authority, migration or lifecycle proof.

* test(gateway): deslop s0310 tests

Consolidate auth retry lifecycle fixtures, transcript publication observers, and model configuration setup while retaining distinct authority and lifecycle cases.

Keep ZIP as the representative Full Access host download: TXT and PDF use the same sessions-file-download path. Text HTTP bytes remain covered by artifact-downloads.test.ts; PDF GET, HEAD, and range bytes remain covered by server.agent-artifact-apis.test.ts. The retained host test still checks exact bytes and permission revocation.

CI-only campaign: plain oxlint, oxfmt, and diff checks pass; tests and coverage were intentionally not run. Static cases 99 to 97; shard lines 3890 to 3823. Below the 25% target because further cuts would remove distinct authority, lifecycle, or externally used helper contracts.

* test(gateway): consolidate s0310 duplicate proof layers

Remove catalog policy replay covered by sessions-describe-worker current-agent cases, session-utils-model.thinking-default owner cases, and session-utils.metadata-perf catalog publication. Roster status and run IDs remain covered by sessions-read-active pagination/activity cases.

Remove ordinary model-policy replays covered by utility-model-setting, model-selection-alias-scope, model-ref-profile, and doctor-config-analysis fallback suppression. Keep the selected-agent alias/utility and disabled-utility gateway regressions.

Consolidate auth retry tables, dirty-topology discovery proof, and Claw selection/review/publication fixtures. Keep exact publication bytes, credentials, revision conflicts and authority revocation. Remove the lower-size draft duplicate; the maximum-size case exercises the same save and conflict branches.

CI-only: no test, coverage or build runs. Plain oxlint, oxfmt and diff checks pass. Original shard 3890 lines to 3620; reduction remains below 25% because remaining cases and shared support retain distinct boundaries.

* test(gateway): remove remaining s0310 fixture duplication

Assert Claw selection directly through the RPC review response instead of replaying prepareClawDraft, retain exact selected files and exclusion metadata, and use a minimal native YAML manifest fixture. Retain reviewed archive bytes and publication authority checks.

Reuse the existing request gate for discovery interleavings, trim unused model probe summary/config metadata, and leave generic alias parsing to model-selection and model-selection-alias-scope owner tests while retaining selected-agent model and utility composition cases.

Remove createAccountCronJob after repository-wide search found no callers. Other approval and cron support exports remain consumed. CI-only: no tests or builds run; plain oxlint, oxfmt and diff checks pass. Shard now 3561 lines versus original 3890; below 25% because apparent remaining siblings exercise distinct request paths or authority checkpoints.

* test(telegram): deslop s0311 tests

* test(telegram): consolidate s0311 fixtures and redundant proof

Reuse the existing Telegram HTTP fixture for model callback proof. Keep per-callback authorization assertions and remove internal catalog-call inventories.

The retained credited-blockquote split test covers the removed uncredited split input. The serial commit case covers the success path exercised by the removed disk-error test, whose optional error callback was never invoked. Keep missing-cache coverage as the direct-message recovery negative control.

* test(telegram): consolidate s0311 branch tables and lifecycle fixtures

Share parser and scoped authorization assertion tables, preserve menu publication ordering without duplicate counts, and use one deferred lifecycle fixture for first-turn and serial-lane holds.

Combine legacy promotion and embedded-ancestry reopen proof while retaining explicit thread correction and storage assertions. Remove repeated model callback HTTP inventories while keeping real outcomes, authorization and media cleanup ordering.

* test(matrix): remove s0308 fixture-only layers

Port s0308 commits 4fc04a9fb8a2e7bac4cd1eb4b585707ee71c1b03, 30721c9ab2187d21c3f34096905896dab5b585d9, and 444611248bdc3d6b53f4976c9e7e1c54ddd5c4d6 onto the campaign lane. The first commit was already represented. Preserve the lane mock setup and unrelated suppression cleanup while applying the remaining test consolidations and fixture removal.

CI-only proof: oxlint and oxfmt --check passed on all 11 changed files; git diff --check and staged diff check passed. Source-only autoreview found no actionable P0-P2 findings. Tests intentionally not run; affected tests are deferred to landing PR CI.

* test(agents): deslop s0314 tests

Share repeated schema, filesystem, environment, and provider fixtures without dropping distinct boundary cases. The Windows shell smoke is covered by the seven getShellConfig on Windows selection cases, now asserting complete invocation configs. Other shard files retain distinct lifecycle, authority, and error-classification contracts.

* test(agents): consolidate s0314 boundary fixtures

Consolidate terminal precedence decisions and query instruction cases, reuse the existing context model builder, and remove redundant successful-execution mock counts. Memory extra-path normalization remains covered by config-utils.test.ts: preserves distinct patterns and canonicalizes unpatterned objects; this shard retains default/agent composition proof. Distinct authority, lifecycle, and error paths remain.

* test(agents): trim duplicate settings snapshot checks

Keep stored-byte preservation and isolated manager mutations in the stored-settings cases. Frozen settings until explicit reset remain covered by keeps policy settings frozen until reset without persisting attempts. Retain undefined, zero, and positive retry counts without repeating the same positive-count branch.

* test(tui): deslop s0312 tests

Keep distinct approval, privacy, recovery, and lifecycle assertions. Consolidate formatter cases and prompt fixture calls without changing their assertions.

Drop equivalent cleared-wait cancellation rows in favor of absent-wait rows, and shorter startup replays in favor of the retained 240-second send/new cases. Nested-cause redaction remains covered through the real send failure path in tui-command-handlers.test.ts (send failure: secret-bearing cause).

CI-only campaign: plain oxlint, oxfmt and diff-check passed; no tests or coverage run. Reduced shard from 4459 to 4423 lines, below the requested 25 percent target because remaining cases protect distinct boundaries and interleavings.

* test(tui): consolidate s0312 test layers

Remove duplicate model-catalog tests and owner fixture from stream support; registerEmbeddedModelCatalogTests in embedded-model-catalog.test-support.ts retains the same three catalog contracts. Align the stream harness with its existing caller instead of the stale nonexistent context export.

Consolidate confirmation, collapse/reopen, bang-routing, history-gap, startup retry and image-render scenarios while retaining their branch assertions. Keep approval ownership, secret masking, cancellation races, recovery and persistence proof.

Remove duplicate HTML formatting and RTL padding checks covered by assistant-error-format.test.ts and tui-formatters.rtl.test.ts. Command-marked finals remain covered by tui-event-handlers.test.ts; disconnected admission remains covered by tui-command-handlers.test.ts and the subscription recovery PTY case.

CI-only: plain oxlint, oxfmt and diff-check pass; no tests run. This round removes 336 lines: 4423 to 4087. Original shard baseline is 4459 lines, so the total reduction is 8.3 percent and does not meet the requested 25 percent target.

* test(tui): remove s0312 duplicate lifecycle probes

Keep stale-reload suppression in the complete-drain reset case and remove separate coordinator probes covered by the event-handler queued-rebuild and final-before-failed-history cases.

Keep pre-new captured-submit epoch protection; reset-time captured input is covered by tui-reset-transition-pty.e2e.test.ts. Remove the plugin coalescer call-count replay and the image abort/late-final replay covered by tui-event-handlers.test.ts, retaining attachment-error suppression locally.

No tests run under CI-only instructions. Plain oxlint, oxfmt and diff-check pass. Shard is 4021 lines from original4459 (9.8 percent reduction), still below the requested25 percent; remaining distinct authority, privacy, recovery and persistence proof was retained.

* test(commands): deslop s0313 tests

Share maintenance admission fixtures and relay reads without changing lifecycle interleavings. Consolidate sandbox probe setup and retain the unavailable-engine diagnostic and remediation assertions.

Drop the copied database family inventory from runtime JSON composition. Remaining boundary proof: status-database-engines.test.ts projects the same physical store facts in text and JSON; status-json.test.ts retains the experimental=false assertion.

CI-only shard: no tests or coverage run. Formatting, diff check, and plain oxlint pass. Retain all distinct auth, sandbox, migration and recovery cases; the 25 percent line target is not reached.

* test(commands): consolidate s0313 duplicate proof layers

Use the existing historical SQLite fixture and retain shared-path fencing, refusal, schema and data sentinels. Participant, creator and Goal-schema preservation remain covered by openclaw-agent-participants-migration, creator-namespace-migration and openclaw-agent-goal-operations-schema tests.

Keep status runtime/backup scope proof while dropping JSON projections covered by status-json, status.usage-routing and status.update-ledger tests. Consolidate identical header-comparison variants and shared config, health and plugin fixtures; retain distinct safety paths.

CI-only: plain oxlint, oxfmt and diff-check pass; no test, coverage or build runs. Combined shard reduction is 3988 to 3466 lines (13.1 percent), below the 25 percent target.

* test(commands): reduce s0313 fixture and projection duplication

Share maintenance import and refusal setup, credential and sandbox status tables, exact archive helpers and scoped database cleanup. Keep every distinct admission, schema recovery, file preservation and lifecycle assertion.

Remove duplicate HTTP auth execution from wizard tests: gateway/auth.test.ts, gateway/ingress-attribution.test.ts, gateway/net.test.ts and packages/net-policy/src/ip.test.ts retain matching and authority proof. Wizard tests assert exact emitted config and consent. Plain and escaped memory references remain covered by automatic-config-repair.test.ts and config-flow-steps.references.test.ts; retain canonical precedence with live env rotation here.

Capture real status JSON writes. CI-only: formatting, plain oxlint and diff check pass; no tests or builds run. Combined shard is 3988 to 3277 lines, 17.8 percent down; the 25 percent target remains unmet.

* test(claws): deslop s0315 tests

Consolidate package, profile, and portable automation fixtures while retaining distinct authority, rollback, filesystem, and lifecycle assertions.

Remove the duplicate golden digest case covered by the restrictive-umask golden artifact test. Remove mocked sibling-workspace drift covered by the initial reviewed-plan rejection and gateway planner occupancy-integrity tests.

CI-only campaign: formatting, plain oxlint, and diff-check pass; runtime tests and coverage intentionally deferred to hosted CI. Safe reduction is 3959 to 3644 lines (8.0%), below the 25% target because remaining scenarios protect distinct boundaries.

* test(claws): consolidate s0315 owner-boundary suites

Merge package cases into the runtime suite and portable automation into stateless Add without changing their Vitest project. Exercise MCP cleanup through pre-publish compensation instead of a mocked rollback plus separate helper replay.

Retain package source and receipt assertions in the database-backed install flow, ownership rollback in stage compensation, and artifact/license/profile assertions in one deterministic build flow. Shared YAML feature branches remain covered by schema.test.ts; profile diagnostic routing stays covered here.

CI-only validation: plain oxlint, oxfmt, and diff checks pass. No test or coverage runs. Cumulative shard LOC is 3959 to 3287, below the requested 25 percent reduction; distinct authority, filesystem, and lifecycle guards remain.

* test(ui): share remaining s0317 fixture utilities

Reuse exactButton and twoFrames from chat-presentation support and configSnapshot from config-composer support. Use Node's JSON stream consumer for the synthetic token endpoint. Keep all existing scenario assertions and auth, lifecycle, persistence, protocol and rendering probes.

* test(gateway): deslop s0318 tests

Share credential, imported-publication, transcript, tool lookup, and prewarm fixtures while retaining all test cases and security/lifecycle assertions. Redundant prewarm counts remain covered by ordered events, the elapsed-deadline test, and the failure-continuation warning. Further structural cuts would drop distinct behavior in this already-consolidated shard.

* test(gateway): remove duplicate s0318 test layers

Collector cases remain in tool-resolution.swarm-collector.test.ts and terminal controls in tool-resolution.terminal.test.ts. Prewarm shutdown ordering remains in the handler row of server-idle-task.lifecycle.test.ts: joins started work before the Gateway sidecar owner closes.

Keep credential precedence at its synchronous owner and secret materialization in the async cases. Cover imported binding precedence with an unprepared target and an older publication. Remove internal transcript reader instrumentation while retaining exact rendered output, privacy variants, and bounded-reader tests. Reuse the canonical environment restoration helper.

* test(gateway): consolidate s0318 policy and lifecycle fixtures

Replace the sandbox policy cross-product with representative owner paths, retaining native/prepared/loopback rename and admission proof. Generic policy variants remain in sandbox/tool-policy.test.ts and tools/sessions-create-tool.test.ts.

Reuse the existing hanging MCP server and WebSocket close helpers. Consolidate authored credential provenance setup. Common guest merge/close denials remain in github-publication-actions.test.ts; generic cleanup-error continuation remains in test/helpers/qa-gateway-cleanup.test.ts while nested ACP join ordering stays here.

* test(telegram): avoid shadowing command fixture

* test: preserve d528 boundary coverage and current fixtures

* test: preserve current d528 fixture and rollback contracts

* test(gateway): retain lint-safe lifecycle fixtures
…claw#181242)

fix(ui): let keyboard users reach the dashboard widget Granted badge

A dashboard widget's "Granted" badge showed its capabilities in a tooltip on mouse hover only; keyboard users could not focus it. The badge is now focusable and shows the same capabilities tooltip on focus. Escape closes it while keeping focus, Enter reopens it, and Tab moves on as before.

Evidence: built Gateway serving its own built Control UI, Chromium. On main Tab skipped the Granted badge (twice) while hovering showed the tooltip; with this change Tab reaches the badge and the tooltip text is in the accessibility tree (twice). Escape keeps focus, Enter reopens and the next Tab reaches the menu. Before/after screenshots are in the PR. Production +7/-2.

Thanks @Pick-cat.

Co-authored-by: Ayaan Zaidi <[email protected]>
…#183503)

* fix(update): retain failed Doctor diagnostics after custody

* test(update): isolate the borrowed phase deadline
…openclaw#183527)

* test(agents): deslop s0295 tests

Consolidate repeated fixtures and assertions while retaining all 105 expanded cases. Preserve auth, replay, transcript ancestry, host isolation, compaction, and lifecycle boundaries. CI-only validation: formatting, diff-check, and plain oxlint; test and coverage proof deferred to hosted CI.

* test(agents): remove redundant s0295 test layers

Retire the obsolete foreground fixture that imports the removed createCompactionResourceRegistry helper and remove its inventory entries. Actual registration lifetime remains covered by compact.queued-resources, compact.delegate-resources, context-engine-maintenance.resources, and context-engine registry resource suites.

Keep host caching/materialization proof in session-snapshot and resources.workspace; keep compaction degradation/corrective recovery in compaction-safeguard and agent-session-compaction.provider-boundary; keep deadlines and stale callback proof in lane-controller and run.compaction-loop-guard. Consolidate prompt-mirroring into admitted recovery, remove duplicate successful-assistant error variants covered by assistant-failure.failover and thinking owner tests, and retain full current/completed provider attribution.

Remove fake disk persistence and prepared-runtime scaffolding; preserve JSONL ancestry, auth, permissions, pricing, and recovery assertions. CI-only validation: plain oxlint, oxfmt, diff-check; no tests or coverage run.

* test(google): deslop s0294 tests

Consolidate model-resolution tables, embedding fixtures, retry cases, and provider setup without removing distinct auth or lifecycle assertions.

The preview migration request assertion is retained by the gemini-embedding-2-preview row in supports %s with %i output dimensions. This preserves the preview endpoint and RETRIEVAL_QUERY contract introduced by e30279f.

CI-only shard: 3875 -> 3467 test lines (-10.5%); below the 25% target because remaining transport, isolation, and lifecycle cases cover distinct behavior. Local oxlint, oxfmt, and diff checks pass. Tests and coverage deferred to hosted CI.

* test(google): consolidate s0294 duplicate test layers

Reduce the shard from 3,875 baseline lines to 2,901 (25.1%); this follow-up removes 566 lines from the first pass. Preserve credential, privacy, retry, bounded-read and lifecycle assertions while sharing fixtures and collapsing same-path variants.

Remaining owners: memory-embedding-adapter.test.ts covers multimodal support, stable async request formatting and cache identity. provider-registration.test.ts covers Vertex routing and native-video classification. provider-hooks.test.ts owns thinking stream hooks; provider-tools.test.ts owns Gemini schema normalization and diagnostics. provider-policy-api.test.ts owns thinking-level matrices. cli-backend-auth.test.ts owns incompatible credential rejection. api.test.ts owns Gemini origin normalization. transport-stream.test.ts and packages/ai Google thinking tests retain serialized thinking-policy proof.

The retained embedding dimension cases now exercise default dimensions and prefixed preview requests at the provider boundary; embeddings-model-normalize.test.ts owns generic prefix stripping. Keep fresh response factories for speech retries. Remove redundant file-level describe wrappers without changing test isolation. Validation: plain oxlint, oxfmt and git diff --check passed. No tests, coverage or builds run: campaign CI-only mode.

* test(gateway): deslop s0300 tests

Remove duplicate cached-statement calibration covered by src/test-utils/main-thread-sql-spies.test.ts (observes every native SQL method and restores observation and refusal scopes). Retain resolver calibration and idle assertions.

Consolidate membership mutation fixtures and simplify scoped spy cleanup and shutdown reply scaffolding without dropping behavior cases. CI-only validation: oxfmt, plain oxlint and diff check; test execution deferred to hosted CI.

* test(gateway): consolidate s0300 lifecycle proof

Reuse the existing Gateway close-race fixture for catalog, workspace, notice and OAuth shutdown proof. Preserve all persistence and admission assertions.

Move membership refresh failure recovery assertions into the stronger stale-read key/store cases. Drop the duplicate connect-error cleanup row covered by test-helpers.acquisition.test.ts verifyCompositeAcquisition; retain the start-throws case.

CI-only validation: oxfmt, plain oxlint and git diff --check. No test or coverage execution.

* test(gateway): trim redundant s0300 proof scaffolding

Share placement environment setup and reuse fixture-owned profile catalog leases. Remove internal forwarding assertions where tool outputs and authority rejection already prove the behavior.

Keep node lifecycle outcomes while dropping initial inventory, fixture-state and repeated delivery assertions. Connectivity is covered by node-registry.test.ts; member addition and group publication remain covered by the physical-alias membership test.

CI-only static gates: oxfmt, plain oxlint, diff check. No tests or coverage run. The 25 percent shard reduction target remains unmet because remaining cases protect distinct authority and lifecycle boundaries.

* test(cli): deslop s0299 tests

Remove duplicate unreachable-Gateway state-custody cases; gateway-backed-exit-health.process.test.ts retains the same ten command/output and seeded-state combinations in the same CLI-process lane.

Keep the mixed-case JSON MIME variant with charset as the representative normalization case, and share bootstrap assertions without weakening authentication ordering checks. CI-only campaign: formatting, plain oxlint and diff checks passed; runtime proof deferred to hosted CI.

* test(cli): consolidate s0299 fixtures and duplicate proof

Table relay deadline and fail-closed scenarios; share channel argv, completion install, device pairing and OAuth HTTP fixtures. Preserve distinct authorization, cleanup ordering, JSON and state-integrity assertions.

Keep deferred dual-TTY failure proof in test/cli-json-stdout.hooks.e2e.test.ts (dual-TTY report and missing hook through dual-TTY finalization). Fatal terminal restoration remains in src/infra/unhandled-rejections.fatal-detection.test.ts and src/runtime.test.ts. Retain natural completion here. Byte-identical database snapshots subsume the duplicate stored-token reread.

CI-only: formatting, plain oxlint and diff checks passed. No tests or coverage run. Total shard cut remains below 25% to preserve distinct behavior.

* test(cli): remove redundant s0299 proof layers

Reuse the real CLI fixture for proxy help-as-value instead of reconstructing Commander and exit finalization. Consolidate run/finalizer/signal wait setup, completion generation and install, and OAuth replies; remove same-branch input replays.

Completion publication failure remains covered by completion-runtime.test.ts preserves an existing profile when atomic publication fails and nodes-camera.test.ts preserves output mode and contents on decoded write failure. JSON diagnostic formatting remains covered by logging/logger-env.test.ts and logging/log-file-size-cap.test.ts. Keep symlink publication and permission assertions here.

CI-only: plain oxlint, formatting and diff checks passed; no tests or coverage run. Preserve distinct custody and authority cases rather than forcing the 25% target.

* test(gateway): consolidate s0291 owner and startup fixtures

Port s0291 onto the campaign lane, preserving the HEAD-added generated-title provenance test and its assertions through the consolidated session creation helper.

CI-only validation: oxlint and oxfmt --check passed for all 12 touched files; git diff --check passed. Isolated review found no actionable port regressions. Tests were not run per campaign instructions.

* test(sessions): deslop s0297 tests

Consolidate target fixtures and legacy transcript row reads without changing ownership, error, durability, or lifecycle assertions.

The retained custom-store table covers default, basename-matching non-owner, and sessions.json paths. The noncanonical numeric suffix case also proves skipping an occupied conventional suffix, replacing the standalone duplicate.

CI-only: oxfmt, plain oxlint, and git diff --check pass. No tests or coverage run. LOC 4527 to 4424; the 25% shard target is not met because remaining cases protect distinct storage and authority boundaries.

* test(sessions): remove duplicate s0297 proof layers

Remove the retention matrix duplicated by session-entry-patch.retention.test.ts: preserves retention freshness across an entry patch, and preserves retention facts without reading trajectory rows during a metadata patch.

Keep prepared rewrites at the public rewrite boundary and in session-actor-message-rewrite.test.ts (reuses resident metadata; rejects a prepared rewrite after another metadata edit). Remove the redundant backend call-count probe.

Timing fields and log redaction remain in session-accessor.sqlite-scope.test.ts. Pruning outcomes remain in session-history-eviction.test.ts (pages past protected archives; remeasures incompressible archive publication; prunes the canonical archive row). FTS mapping remains in session-transcript-projection-rebuild.test.ts (keeps worker chunks and interrupted rebuilds mapped with missing content).

Retain native commit order, canonical transcript bytes/timestamps, authority boundaries, and recovery interleavings. Use a real metadata append for the reaction fixture and factor repeated dispatch inputs.

CI-only: oxfmt, plain oxlint and git diff --check pass; no tests or coverage run. Shard LOC is 4527 to 3952 (12.7% reduction), below the 25% target.

* test(sessions): consolidate s0297 owner proof and fixtures

Remove writer-owner replays covered by the prepared-admission FIFO and native-deletion cases, lifecycle-publication committed settlement cases, native-binding reclamation, and maintenance-worker/kick suites. Keep conversation authority at the typed route boundary in session-entry-patch.operations.

Share target registrations, pending-input fixtures and the canonical message-event builder; remove duplicated private predicate and diagnostic wording assertions. Preserve distinct memory receipts, migration interleavings and projection publication guards.

CI-only: direct oxlint, oxfmt and git diff --check passed. No tests or coverage run. Shard LOC 4527 -> 3593 (20.6%); the 25% target remains unmet because additional candidates protect distinct authority, durability or race paths.

* test(ollama): deslop s0298 tests

Consolidate repeated HTTP and cancellation fixtures, auth setup, and response assertions without deleting distinct boundary cases. Remove unreachable branches left in single-row setup tables. Preserve credential isolation, stream cleanup, model metadata, and deadline regressions.

* test(ollama): consolidate s0298 owner-boundary proof

Move normalization into the embedding real-transport table and pull timers into setup-pull's existing harness. Consolidate model discovery/cap and paired-node cancellation proof; remove redundant catalog, auth-variant, helper-budget and mocked pass-through replays. Preserve unique credential, origin, deadline, cleanup and cache assertions.

Keepers include provider-discovery's configured routing/catalog tests, provider-models output-limit discovery, paired-node transport, setup pull request assertions, and real embedding normalization. No tests or coverage run under campaign CI-only mode.

* test(ollama): remove duplicate s0298 test layers

Consolidate fixtures and equivalent discovery, selection, and transport paths while retaining auth, protocol, and lifecycle assertions. Combine captured-response cleanup and socket-close proof in setup-pull's real HTTP cases.

Keep oversized NDJSON cancellation proof in stream-ndjson.test.ts (cancels an oversized unterminated record). Hosted/configured discovery remains covered by provider-discovery.test.ts; parameter discovery retains the Modelfile context assertion.

Shard total: 4135 to 3100 lines (25.03%); this pass: 3553 to 3100. Plain oxlint, oxfmt, and diff-check passed. Tests and coverage intentionally not run under CI-only instructions.

* test(skills): deslop s0301 tests

Keep prompt budget, hidden discovery, remote-note byte boundaries, and state-root path behavior in workspace-skill-prompt.test.ts instead of replaying them in prompt-resolution. The resolution suite retains degraded-owner and captured-content contracts.

Full/count-limited/empty catalogs remain covered by the optional remote-note boundary table; tiny limits by the tiny-budget table; final notice budgeting by tier 3. Root precedence remains covered by workspace-precedence collision cases, and selected/empty filters by the pinned-command library read case. Reuse the existing loading fixture for snapshot home lifecycle.

CI-only: oxfmt, plain oxlint, and diff-check passed. Static cases 157 to 143; shard lines 4419 to 4009. Below the 25 percent line target: retained distinct containment, host authority, cancellation, discovery, cache, and recovery tests. No tests or coverage run.

* test(skills): consolidate s0301 branch fixtures and duplicate proof

Table prompt budgeting, configured-root discovery and source-specific containment branches. Shrink aggregate warning, binary classification, growing-file and snapshot fixtures without removing distinct outcomes. Preserve the fsync regression from openclaw#181928 with a focused assertion.

Remove loader cache replay covered by session-snapshot-content tests for execution isolation, losing edits and interleaved selections, plus discovery.integration unchanged-work/additions tests. Remove manifest channel-disable replay covered by config-state manifest-owned channel disable and plugin-root-contributions activation filtering. Remove the database-failure prompt probe because explicit entries bypass its claimed failure boundary; discovery.worker-imports retains actual no-persistence discovery proof. Full remote-note catalog bytes retain outside-home path rendering.

Library preparation mode variants share captureWorkspaceSkillPreparation and prepareCapturedWorkspaceSkillEntries; retain prompt capture and warm invalidation. Both sandbox fixture variants discarded the host snapshot; retain the hydrated adversarial case. No dead production subjects or safe whole-file duplicate layer found.

CI-only static validation: oxfmt, plain oxlint and diff-check passed. No tests, coverage, builds or typechecks run. Additional 398 test lines removed; original shard 4419 to 3611 (-18.3 percent), still below the 25 percent target. No production or helper files changed.

* test(meeting-bot): deslop s0302 tests

Share native stall recovery, terminal pull, and eviction setup while retaining both trigger paths in each table. Centralize startup fixture cleanup and repeated assertions without removing lifecycle or authority cases.

* test(meeting-bot): consolidate duplicate s0302 proof layers

Keep response event bookkeeping in the talk realtime-session-harness tests; retain incomplete-response playback in the meeting engine. Keep setup-only backend proof in configured-node-host provisions/probes and timer caps in Google Meet config plus Zoom CLI budget tests.

Consolidate replay identity into queued attachment replay and subscriber authorization into the drain test; durable live/replay data remains in transcripts-bridge.provenance. Fold generation fencing into pending-clear proof and retain output acceptance in node-host.audio. Reuse existing runtime, platform, and state fixtures without removing running-agent cancellation or authority checks.

* test(meeting-bot): share s0302 lifecycle scenario harnesses

Share queue-limit and backpressure recovery drivers while retaining both owner-fence paths and both queue limits. Share terminal-pull and subscriber-drain setup with every interleaving retained. Use the real binding factory and one audio mock shape in Chrome transport tests.

* test(buzz): deslop s0303 tests

Reuse the existing relay and account-context fixtures for cold-start recovery and replace the handwritten relay filter with nostr-tools matchFilter. Remove unused disconnect injection and manual environment restoration.

Keep reply-mode behavior in buzz-bus.lifecycle.test.ts (signs all/off-mode replies and typing without changing inbound threads); inbound.test.ts retains labeling, empty replies, keepalive and delivery/record errors once. Structured diff formatting still checks every parsed metadata field, with raw multiline description checked separately.

CI-only shard: oxlint, oxfmt and diff-check passed; no tests or coverage run. LOC 4375 -> 4274 (-101, 2.3%), below the 25% goal because remaining cases protect distinct protocol, authority, lifecycle and persistence behavior.

* test(buzz): consolidate s0303 fixtures and boundary proof

Consolidate plain/native/explicit standalone sends, preserving the separate plain-auth path. Merge signed-roster validation with the socket stale-query interleaving. Keep profile abort, membership revocation, restored-room lifecycle, credential and replay cases intact.

Remove duplicated fixture layers, unused relay bookkeeping, copied subscription inventories and wiring assertions. Retain relay-author constraints, missing-Bot-role diagnostics, exact signed threading tags and full replay delivery. Account resolution remains covered by types.test.ts; static room listing by directory-contract.test.ts; query cleanup by directory-relay.test.ts.

CI-only: plain oxlint, oxfmt and diff-check pass; no tests, typechecks or coverage run. Additional reduction 241 lines; shard base 4375 -> 4033 (-342, 7.8%). The 25% target remains unmet; remaining cases guard distinct authorization, lifecycle, recovery and configuration behavior.

* test(buzz): consolidate diff proof at inbound boundary

Move complete structured-diff metadata formatting into the retained inbound diff table. The short-context row checks every field from a signed parsed event through agent context; long-context and required-mention rows retain command/mention isolation, clipping and UTF-boundary checks. Remove the lower-level duplicate from buzz-bus.test.ts.

Consolidate fake-clock process boundaries and use the existing Vitest polling API with the same nominal four-second budget for cold-start settlement. Keep every recovery, queued-message and failed-message assertion.

CI-only static proof: plain oxlint exit 0, oxfmt and diff-check pass. No tests/builds/coverage. Additional 38 lines removed; base 4375 ->3995 (-380,8.7%). The 25% target remains unmet: no other whole file, obsolete subject or repeated branch was identified that could be cut without losing distinct authority/lifecycle/recovery/config proof.

* test(infra): deslop s0305 tests

Consolidate credential read assertions and receipt setup, and share handoff failure/sentinel fixtures and credential-redaction checks. Preserve all security, custody, recovery and lifecycle cases. CI-only validation: plain oxlint, oxfmt and diff check; no tests run.

* test(infra): remove duplicate s0305 test layers

Keep backup alias/WAL proof in backup-create.test.ts and backup-create.sqlite-hardlinks.test.ts; blocked-reader periodic maintenance in sqlite-wal-reclamation.test.ts; newer credential schema rejection in client-credential-lifecycle.test.ts.

Keep healthy short-circuit and post-turn validation in update-repair-agent.test.ts and update-repair-agent.e2e.test.ts. Retain direct missing-runtime validation here. Package recovery admission is exercised through the real journal in cli/update-cli/update-repair-triage.test.ts.

Consolidate ClawPack route/default metadata, admission variants, Git transfer success and bounded triage evidence. Keep renderer proof in commands/triage-prompt.test.ts and unsafe recovery lifecycle proof in update-managed-service-handoff-result.test-support.ts. Remove internal call-shape and inventory assertions. CI-only: oxfmt, plain oxlint and diff-check passed; no test runs.

* test: retain distinct boundary proof after batch review

* test(skills): retain snapshot fixture skill filter

* test: drop replay-incompatible fixture reductions

* test(skills): retain original plugin mock contracts

* test: prune removed repair mock baseline
…claw#183548)

* perf(sessions): avoid serializing retained tool classifications

* test(sessions): use stored actors in classification fixtures

* test(perf): type the bounded classification fixture lookup
* fix: explain plugin installation permission failures

* test: assert repaired plugin manifest structurally
* test(talk): consolidate s0282 recovery proof

Combine failed-entry reset and multi-entry recovery in one close-invariant flow, and stale/recent/resumed calls in one recovery flow. Drop same-branch fresh-agent/default-row replays and duplicate digest payload and record decoding assertions.

Payload formatting and durable-send flags remain in delivers one mutation digest and skips webchat or missing targets. Restart and per-entry recovery remain in retains failed entries across reset and closes only after every entry recovers. Keep distinct source identity, requester revocation, and displaced metadata interleavings.

CI-only: oxlint, oxfmt and diff checks pass; no tests/build/coverage. Additional 71 lines removed, cumulative 4593 to 4297 (6.4 percent); target remains unmet rather than dropping distinct protected behavior.

* test(talk): remove redundant s0282 control replays

The prepared Talk input and caller policy cases in src/auto-reply/reply/message-injection-order.test.ts retain follow-up wrapping and unconfirmed-delivery behavior at the real injection boundary. Keep unscoped adapter queue shape and non-abort checks here.

Retain debounce delivery and coalescing assertions; agent-talkback-runtime.test.ts already checks the brief response-style argument. CI-only validation: plain oxlint, oxfmt and diff check; no test/build/coverage runs.

* test(auto-reply): deslop s0281 tests

Remove the duplicated target-session directive suite from get-reply-directive-aliases.test.ts. The named cases remain in get-reply-directives.target-session.test.ts: persisted identity, terminal errors, combined rejection delivery, suppressed command text, and reasoning authorization/defaults. Keep the real-parser alias and authorization cases.

Consolidate label model-route fixtures, reply-source recovery contexts, and queued TTS channel/config/audio fixtures. Preserve the remaining distinct authority, recovery, ordering, accounting, and delivery assertions. CI-only campaign: plain oxlint, oxfmt, and diff checks passed; no tests or coverage run. Shard LOC 4870 to 4611; below 25 percent because remaining cases protect distinct behavior.

* test(auto-reply): remove redundant s0281 harness layers

Keep directive streaming policy assertions at the directive boundary instead of replaying subscriber delivery. Caption/media delivery remains covered by reply-delivery sends-without-streaming, subscriber caption/media-once and early-chunk-media exclusion, and message-lifecycle final-media-after-caption tests.

Remove the duplicate utility-backup success variant (retained implicit utility-backup test) and named-account mocked addition variant (commands-allowlist.owner pairing-write authority test). Drop duplicate receipt wire-shape assertions already covered by gateway-question-dispatch, an unused session fixture export, and unnecessary promise-result wrapping. Reuse the existing queue-case and steer builders in place of the missing queue-family fixture.

Preserve real delivery receipt generation, custody, recovery, accounting and lifecycle assertions. CI-only: formatting, plain oxlint and diff checks passed; no tests or builds run. Additional LOC 4611 to 4414; cumulative 4870 to 4414, below the 25 percent target.

* test(auto-reply): consolidate s0281 branch fixtures

Share the allowlist refusal runner across six distinct authorization branches without losing output, no-write, prototype-safety or guard-order assertions. Infer account fixture types from production config, simplify recovery contexts, and make the existing fourteen question-receipt cases explicit.

Remove queued TTS policy replays owned by tts-config.test.ts (session precedence and local preference precedence) and tts-runtime-fallbacks.test.ts (persisted tagged facts, visible text after provider failure, and existing attachments). Keep queued session propagation, inbound and tagged rejection, collected inbound eligibility, content exclusion, cancellation and delivery custody checks.

CI-only: plain oxlint, formatting and diff checks passed. No tests or builds run. Additional LOC 4414 to 4327; cumulative 4870 to 4327. The 25 percent target remains unmet because remaining cuts identified would drop distinct protected behavior.

* test(ui): deslop s0283 tests

* test(ui): consolidate s0283 test coverage

* test(ui): trim s0283 repeated proof scaffolding

* test(plugins): deslop s0285 tests

Consolidate repeated provider wizard metadata fixtures and model-picker lookup proof. The retained method-metadata case covers media scopes and model allowlists; the model-picker case also verifies setup-mode resolution.

Keep trusted installed policy coverage in the authored-row identity normalizer, which reaches resolveProviderPolicySurface. Share staging alias and stale metadata fixtures across their distinct branches without removing assertions for private exports or deleted outputs.

CI-only validation: plain oxlint, oxfmt, and diff check. Lines 4630 -> 4493; 25% target not reached because remaining cases protect distinct policy, persistence, artifact, and lifecycle behavior.

* test(plugins): consolidate s0285 duplicate layers

Drop copied managed npm precedence and manifest-read cases. Coverage remains in installed-plugin-index-generation-precedence.test.ts and installed-plugin-index-records.managed-npm.test.ts. Public wizard choice-resolution contracts retain generic provider/method/wizard identity checks; Windows staging fallback proof remains in test/scripts/stage-bundled-plugin-runtime.test.ts.

Share Doctor closure traversal, artifact and metadata fixtures, and model hook setup while retaining distinct policy, lifecycle and persistence outcomes. CI-only: oxfmt, plain oxlint and diff check passed; no tests or coverage run. Original shard 4630 lines -> 3948, still below the requested 25% reduction.

* test(plugins): reuse s0285 owner fixtures and import graph

Reuse runtime-import-closure for static source dependency classification and resolution instead of a test-local scanner. Keep the Doctor dependency guards and use the manifest registry's admitted setupSource. Reuse installed-index and setup-registry fixture builders and remove selector rereads from public inspection cases.

Dist-only artifact preference proof remains in active-runtime-registry.test.ts (selected bundled setup artifact matrix). Configured Codex startup proof remains in channel-plugin-ids.test.ts (implicit runtime default/selectable model cases). Retain distinct installed trust, policy, retirement, ordering and persistence cases.

CI-only static validation: plain oxlint, oxfmt and diff-check passed. No tests or coverage run. This pass cuts 3948 -> 3774 lines; cumulative 18.5%, still short of the requested 25% target.

* test(worktrees): consolidate s0284 boundary fixtures

Replace the CLI scale replay with one record per decision path, retaining unmanaged protected paths and dead/live lease distinctions. Scale remains covered by service.gc-performance bounded inventory/live-lease sweeps and owner-protection large-census coverage.

Share private Git metadata relocation fixtures, consolidate restore injection and retirement setup, and remove internal command-shape/template-call assertions backed by retained bytes, registration, snapshot and template identity outcomes. Preserve every case and distinct safety interleaving.

Port s0284 onto the campaign lane, preserving its newer service-files.test-support.ts unchanged. CI-only validation: oxlint and oxfmt passed for all 11 changed files; git diff --check passed. Tests intentionally not run; affected-test execution belongs to landing PR CI.

* test(boundaries): deslop s0288 tests

Share boundary scan and import matching scaffolding while preserving all case assertions and scanned roots. Keep four scan guards as independent table cases. The generic test/helpers pattern already covers its channels and plugins subpaths.

* test(ui): deslop s0287 tests

* test(models): deslop s0289 tests

Retain built-in alias shadowing in the case-collision removal test: the same user-alias branch clears both matching entries while preserving an unrelated alias. Share account action invocation while retaining both exact authenticated-person RPC contracts.

* test(models): consolidate s0289 branch fixtures

Share alias JSON/plain/text and catalog plain/rich rendering fixtures while retaining exact terminal escaping, raw JSON, prototype keys, tag roles, ordering, and context caps.

The MiniMax chat login table retains persisted-credential and revoked-command assertions instead of rechecking the private authorization predicate. The foreign-hook runtime case retains actual selected-model proof instead of a registry inventory. Remove redundant transport invocation counts while preserving socket-affinity, cancellation acknowledgment, OAuth fences, rollback, and cleanup checks.

* test(models): remove redundant s0289 owner layers

Keep Claude CLI projection coverage at models-list-result.plugin-runtime.test.ts and provider recovery/health variants at oauth-refresh-failure.test.ts and usage-state.test.ts. Retain command projection and secret-redaction boundaries.

Use real fixture-owned provider auth classification and persisted credentials instead of fake algorithms; exclude external credential overlays. Move direct OAuth and no-tail cleanup proof into their retained owner fixtures. Remove the probe alias case whose behavior existed only in its normalization mock.

Keep source-only built-in/authored alias writes in model-selection.runtime.test.ts, with manifest alias selection retained in models.set.e2e.test.ts. CLI logout routing remains in models-cli.test.ts; persistence, rollback, and partial-removal proof stays at the actual logout command.

* test(gateway): deslop s0290 tests

Consolidate restart intent and cron native-owner cases into existing tables without removing executed cases. Factor repeated catalog restart and service-tier observation setup. Keep rotated abort receipt identity proof through getAgentJobSession and tier-filter proof through observable catalog output instead of duplicate internal call-shape assertions.

Shard LOC: 3822 to 3648 (4.6%). Declarations: 37 to 34; expanded cases: 91 unchanged. The 25% target is not safe for these already-consolidated authority, sandbox, recovery, and lifecycle scenarios. CI-only: plain oxlint, oxfmt, and diff-check pass; no runtime tests or coverage executed.

* test(gateway): remove duplicated s0290 owner coverage

Keep successful Web Push get/set and publication ordering in push-preferences.worker.test.ts. Keep generic request guard and transport-loss coverage in push-authority-in-process.test.ts, push-authority-router.test.ts and session-mutation-guards.retained.test.ts; retain push-specific scope/profile changes, read cancellation, user-write admission/commit/completion revocation and device-write guards here. The profileless device-preferences success remains in push.test.ts.

Keep malformed, incompatible and stale remote catalog preservation at remote-refresh.test.ts and remote-overlay.test.ts. Keep untargeted stale restart authority in restart-owner.test.ts (requester-revoked); retain the targeted path here.

Additional 87 lines removed; original shard 3822 to 3561 lines (6.8%). 82 expanded cases remain. Further whole-file deletion would lose distinct authority, guest sandbox, recovery or lifecycle behavior. Plain oxlint, oxfmt and diff-check pass; CI-only, no test runs.

* test(gateway): consolidate s0290 branch and fixture coverage

Collapse absent-receipt combinations into unchanged/successor cases covering both outcomes of the current-versus-captured receipt guard in sessions-abort.ts. Preserve post-COMMIT persistence, exact receipt ownership, cancellation and transcript assertions. Remove internal receipt inventories and duplicate write-count assertions.

Trim unused scheduler output and copied preflight counters, consolidate logout phase gates and sandbox layout setup, and remove catalog assertions already enforced by waitForRows. No production changes or whole-file deletions.

This pass: 3561 to 3503 lines. Original shard: 3822 to 3503 (8.3%), below the requested 25% because remaining unique authority, guest isolation, recovery and lifecycle boundaries have no equivalent keeper. Plain oxlint, oxfmt and diff-check pass; CI-only, no test runs.

* test(agents): deslop s0292 tests

Remove duplicate deadline diagnostics covered by isolated-completion-diagnostics.test.ts: joins tail work, disabled phases, release failure, lifecycle timing, and attempt aggregation. Keep deadline and cancellation assertions in their owner suite.

The held-lease requester bearer test retains fresh-token/no-refresh proof. Share OAuth tokens, runtime-policy fixtures, and streamed privacy setup; remove single-row reply-tag table scaffolding without dropping cases.

CI-only audit: 4501 to 4259 lines; 103 to 99 declarations and 174 to 168 expanded cases. The 25 percent target is not met: remaining tests protect distinct security, lifecycle, budget, and routing behavior. Plain oxlint, oxfmt, and diff-check passed; tests and coverage deferred to hosted CI.

* test(agents): consolidate s0292 owner-boundary proof

Move catalog callback-retirement proof into the native context-change keeper, preserving finalization controls and post-retirement sampling. CJS-specific loader retention remains covered by workspace-heap and reuse integration suites.

Drop provider reader lifecycle replays owned by http-body.response tests and Retry-After replays covered by the embedding HTTP boundary and retry-policy parser. Preserve ordinary metadata and redaction assertions in retained provider cases. Generic aggregate truncation remains owned by tool-result-truncation tests.

Replace sandbox normal-flow transport inventories with disk effects while retaining denial guards, and collapse the model visibility fixture's duplicate builder. CI-only: oxfmt, plain oxlint and diff-check pass; no tests run. Shard totals are 4501 to 4094 lines, below the requested 25 percent cut; no further distinct behavior was discarded to force the target.

* test(agents): factor s0292 fixtures and redundant network cases

Keep suspended network value and failure coverage in code-mode.wait.test.ts (wraps network content acquired after a safe suspension); retain direct and caught-error cases here using the existing exec/wait surface instead of stale completeResult.

Consolidate OAuth refresh proof into the logout-race case, retaining scope, bearer and refresh-count assertions. Remove DB cleanup duplicated by withMcpOAuthTempHome. Factor block-reply collection, policy model fixtures and poll arguments without weakening privacy, owner contrasts or final activity counts.

Use the existing catalog runner for remote retention sampling instead of undefined fixture helpers. CI-only: oxfmt, plain oxlint and diff-check pass; no tests run. Additional cut is 4094 to 3979 lines, original shard 4501 to 3979; the 25 percent target remains unmet.

* test(boundaries): remove redundant s0288 integration layers

Port s0288 commits 0553429c2c62b824f6665730976a1fe14748fd37, 27fe89482e1eee9095f79547306579d5f282fea1, and d55dfbe0561bfb880290b676c927ffecb2948c28 onto the campaign lane as one commit. Preserve lane-added and lane-modified package-script cases and extension boundary guards while retaining the shard consolidations elsewhere.

Validation: oxlint and oxfmt --check on all eight touched files, plus git diff --check, passed. Tests deferred to landing PR CI under the compute-constrained CI-only instruction.

* test(ui): reduce s0287 lifecycle fixture overhead

Port shard s0287 commits a39912e6879d, f84a5e2e1c14, and 53be54b979d2 onto the campaign lane as one commit. Preserve the lane's expired-approval clock regression and changed placement machine-selection and focus-retention tests while keeping the shard's other deletions and consolidations.

CI-only validation: oxlint and oxfmt --check passed for all 12 touched test files; git diff --check and the staged diff check passed. No tests, coverage, Testbox, or check-changed run.

* test(acp): deslop s0293 tests

Keep reset-superseded initialization coverage in manager.initialize-session.test.ts (does not let reset-superseded initialization republish a stale runtime handle). Remove its duplicate from actor-epoch fencing; retain the distinct authority and persistence interleavings.

Reuse runtime-handle fixtures, the existing preparation gate, and native immediate promises. CI-only validation: plain oxlint, oxfmt, and diff check. Shard drops 62 lines (4577 to 4515); 25 percent target remains unmet because the remaining cases protect distinct lifecycle, authority, recovery, and persistence behavior.

* test(update-cli): deslop s0296 tests

* test(update-cli): remove duplicated s0296 test layers

Keep real spawner-killed composition instead of simulated dead-spawner replay. The shared hasUnsettledChildren early return is platform independent. Nested borrower joining remains in service-operation-lock.retained-custody.test.ts; native serialization remains in service-update-authority-runner.test.ts. Doctor external-service refusal stays with doctor-gateway-services.test.ts while the update test retains real committed-byte and finalization ordering checks. Simplify plugin fixture construction and check actionable destination diagnostics without reproducing full paragraphs.

* test(update-cli): simplify s0296 custody fixtures

Reuse the existing validation fixture to observe settlement. Remove duplicate restart cleanup and the obsolete multi-controller receipt registry while preserving native process extinction checks. Remove fixture-local hash restatements and unobserved mock wrappers; retain the public rollback and no-downstream-work assertions.

* test(agents): consolidate s0286 owner coverage

Port 490e8ec3d3ab0b5abb210068b3efe05888e1c641 and 4765d77894c12d8b410bfe6446b70d56338ed2ea onto the campaign lane. Preserve the lane-modified avatar cases in consolidated form and retain its in-flight autosave test with the shared save fixture.

CI-only validation: oxlint on all 10 retained touched files, oxfmt --check, and git diff --check passed. Independent static review found no actionable P0-P2 issues. No tests or coverage were run; affected test execution is deferred to landing PR CI.

* test: retain distinct boundary proof after review

* test: adapt cleanup fixtures to current contracts

* test: repair current-head fixture assertions and signatures

* test(models): retain established automatic probe fixtures

* test(ui): keep catalog and effective fixture schemas distinct

* test: retain native DOM fixtures and prune obsolete mock baseline

* test(ui): preserve exec approval clock and rendering proof
Keeps sticky fallback test cleanup in test support while preserving the process-global cache and its lifecycle.
Removed obsolete external helper surfaces while preserving all live internal callers and fixture behavior.
…aw#183554)

* test(discord): deslop s0316 tests

Exercise canonical gateway approval routing through the retained valid-click table, replacing the narrower direct-context routing cases. Keep removed, unreadable, and replacement control branches, with one representative native card body. Consolidate repeated fixtures and redundant assertions without changing production code.

* test(discord): consolidate s0316 lifecycle fixtures

Share cancellation setup across dispatch, buffer, preflight, queued, and running phases; retain retry facts and replacement replay for every phase. Cover preflight and processing dead-letter paths independently with the same lane fixture.

Use one canonical approval fixture, shared text and voice delivery cases, and centralized binding cleanup. Keep endpoint socket proof in gateway-endpoint-runtime.test.ts while retaining metadata routing here. Model body read failure at the response stream boundary.

* test(board): deslop s0319 tests

Factor repeated progress-card fixtures, frame mounts, renewal setup, and browser pointer/layout helpers. Remove the browser retention diagnostic recorder while retaining its iframe state assertions.

Keep all expanded cases, including ticket deadlines, authority checks, scope changes, teardown ordering, and browser layout. The existing retention and base view suites remain unchanged: their behaviors are not duplicated by the lower-level frame and cell tests. Static reduction: 4079 to 3803 lines (6.8%), below the 25% target without deleting distinct coverage. CI-only: plain oxlint, formatting, and diff check pass; runtime and coverage proof deferred to hosted CI.

* test(sessions): deslop s0322 tests

* test(infra): deslop s0323 tests

Consolidate snapshot options, image cleanup fixtures, and worker budget proof. Rely on the existing reverse-order SQLite fixture cleanup and assert UNIQUE enforcement instead of schema object inventories.

The retained gitNullConfigPath platform test protects the fix from fc3bb9f; remove the old negative probe which only exercises Git with os.devNull. The retained child-reuse case now also proves caller-owned budgeting.

CI-only: oxfmt, plain oxlint, and diff check passed; tests and coverage not run. Shard LOC 4300 to 4210; the 25 percent target is not safely attainable without dropping distinct migration, authority, and lifecycle contracts.

* test(infra): consolidate s0323 owner-boundary proof

Reuse the hot-journal fixture, consolidate native scenario declarations and disposal, and remove duplicate backup verification and internal transfer-call assertions.

Keep invalid credential validation in client-credential-migration.test.ts, family overrides in doctor-migration-resources.test.ts, and declaration authority mismatches in doctor-contract-registry.generation.test.ts. Retain backend recovery, blocked-tail propagation, in-flight Git cancellation, timing attribution, and native cleanup assertions.

CI-only: formatting, plain oxlint, and diff check passed; no test runs. Cumulative shard LOC 4300 to 4082. Target remains unmet because remaining cases cover distinct security, durability, or lifecycle behavior.

* test(infra): consolidate s0323 migration fixtures

Centralize short-lived source/archive database operations and snapshot capture/restore setup. Reuse canonical managed-image record conversion and unlink interception without removing the durability, authority, or race assertions.

CI-only: formatting, plain oxlint and diff checks passed. No test runs. Shard LOC 4082 to 4025 this pass; original baseline 4300. The 25 percent target remains unmet.

* test(chat): deslop s0320 tests

* test(chat): consolidate s0320 coverage layers

Keep per-kind notice projection separate from shared promotion and framing proof. Remove duplicate slug ambiguity coverage (route-resolution.test.ts), mention prose/caret coverage (chat-mention-search.e2e.test.ts), same-label recipient reconciliation (human-mentions.test.ts), attachment handoff/restore composition (chat-pane-attachment-handoff.test.tsx and chat-pasted-text-sidebar.test.tsx), and generic presentation subscription replay (retained native-locality and composer subscription tests).

* test(chat): deduplicate s0320 owner-boundary scenarios

Use shared identity fixtures, combine terminal recovery and route revalidation scenarios, and consolidate process read/write access-loss setup. Keep last-observer retirement in the process-change test; shared read and Stop delivery remain covered by chat-processes-panel.test.ts. Remove repeated notice frame anatomy covered by chat-agent-run-grouping and chat-thread-live-final, and marked skill projection covered by chat-learned-notice.e2e.test.ts. Preserve malformed markers and distinct authorization, replay, and lifetime assertions.

* test(gateway): deslop s0325 tests

Reuse audio, hosted-question, and recovery fixtures while preserving every test case and authority/lifecycle assertion. Remove only redundant exact-string assertions and proof-restating logs. CI-only validation: oxfmt, plain oxlint, and diff checks; runtime proof deferred to hosted CI.

* test(gateway): remove duplicated s0325 test layers

Remove hosted caller instrumentation already covered by server-plugin-in-process-dispatch.session-scopes.test.ts and authorization.test.ts. Keep question outcomes through the real router.

Keep restart outcome/audit proof in host-lifecycle.test.ts and operations.gateway-lifecycle.test.ts; same-owner approval observers in system-agent-approval.test.ts; healthy sibling cancellation in chat.abort-errors.test.ts. Preserve stop authority barriers and durable incarnation fences here.

Consolidate audio transcription/command flows and MCP launch outcomes; reuse existing model and worktree fixtures. Retain distinct credential, policy, publication, recovery and revocation checks. CI-only: formatting, plain oxlint and diff-check passed; no tests or builds run.

* test(gateway): separate s0325 owner proof layers

Keep human-approval settlement in system-agent-approval.test.ts and queued final-effect revalidation in system-agent-approval-authority.test.ts; specialize host lifecycle coverage to six live host boundaries.

Audio tests retain canonical prepared text, prompt redaction, and empty command input. Generic persistence remains covered by user-turn-transcript.test.ts preserves distinct text supplied with late-resolved media; transcript-only reset suppression remains covered by auto-reply/reply/session.test.ts.

Keep real new-recipient consent here, and dispatch identity/revocation proof in sessions-send-communication.test.ts. Reuse existing model/RPC fixtures and trim repeated setup. CI-only: plain oxlint, oxfmt and diff-check passed; no tests or builds run.

* test(agents): deslop s0327 tests

Consolidate shell/catalog fixtures and preserve distinct authority, lifecycle, persistence and redaction assertions.

Retained proof: hosted-catalog recommendations covers selected-first ordering; the shared transient retry case covers the duplicate provider replay; the all-role identity case covers initial-user scrubbing; the real read-tool fidelity case now covers logging-pattern persistence.

* test(plugins): deslop s0326 tests

Share context-engine loader/config fixtures and package-update snapshot setup. Preserve every existing case and behavior assertion; keep lifecycle ordering, admission, retirement, and package cleanup coverage intact. CI-only campaign: oxlint, oxfmt, and diff checks pass; runtime proof deferred to hosted CI.

* test(plugins): consolidate s0326 contract fixtures

Consolidate explicit-owner policies, package replacement branches, and shared lifecycle fixtures. Preserve ordinary and timed-out artifact retirement, async factory handoff, and stale-consumer rejection in their retained flow tests. Remove redundant result inventories, wrapper checks, and two same-branch manifest rows. CI-only: plain oxlint, oxfmt, and diff checks pass; no tests run. Cumulative line reduction remains below the 25 percent campaign target.

* test(database-engine): deslop s0324 tests

Share CLI local-store assertions, SQLite discovery and schema cleanup between one-shot and interactive entry-point tests. Reuse expected transcript identity rows while preserving parsed event comparisons and explicit key-ownership expectations.

All existing cases and security, migration, rollback, recovery and lifecycle assertions remain. CI-only: plain oxlint, oxfmt and diff checks passed; runtime tests and coverage intentionally deferred to hosted CI. The shard remains below the requested reduction target because distinct database behaviors were retained.

* test(gateway): deslop s0328 tests

Consolidate credential and transcript fixtures and remove unused recovery fixture options. Keep fenced-credit repair as the representative for unrecognized attribution layouts through the executor's missing-trailer branch, retaining ancestry, exact credit, replay, and publication assertions.

* test(gateway): compact s0328 recovery fixtures

Exercise correlated completion recovery directly through recoverPendingRestartContinuationDeliveries, retaining all seven original-source, generation, receipt, and cleanup interleavings from fix 1fea5ee. Scheduler ordering and context wiring remain covered by server-runtime-services.test.ts: holds restart session deliveries until subagent sources settle; gives standalone scheduled recovery its owning Gateway context and broker.

Share SSH pairing probe controls and lifecycle cleanup; retain lock-wait revocation, changed SSH identity, scope rejection, mismatch, and successful capability approval. Replace callback-only parse spy scopes with automatic disposal and inspect summary values directly. Reuse publication fixture defaults and exact signed commit bytes.

Remove redundant WebChat target/mailbox implementation assertions: server.startup-recovery-boundary.test.ts keeps owedResendRunsBeforeFirstChatSend and owedResendRunsBeforeChatSendDuringItsAdmission; the retained test still asserts provider ordering, queued cancellation, and surviving followup execution.

CI-only: plain oxlint, formatting, and diff-check passed. No tests or coverage run. Shard LOC 3476 to 3361 this commit, 4032 to 3361 cumulatively; 25 percent target remains unmet without removing distinct behavior.

* test(plugin-sdk): deslop s0329 tests

Remove duplicate catalog acquisition tests already covered in provider-catalog-shared.refresh.test.ts: refresh key isolation and TTL, concurrent refresh sharing, failed refresh recovery, and budget-order isolation. Its nested acquisition budget freshness test also retains the nested-context expiry assertion.

Remove duplicate channel mirror scaffolding already covered in session-transcript-runtime.test.ts: appends keyed mirrors, dedupes unkeyed mirrors, and rejects a rebound session; does not append an assistant mirror after cancellation; rejects assistant mirror/yield context after its admitted writer is superseded; rechecks yield settlement authority after waiting for the transcript writer; dedupes unkeyed assistant mirrors against only the visible SQLite branch; serializes caller-checked idempotency inside scoped locked appends; can avoid synthetic fallback keys for strict live-store checks.

Reuse existing agent stream/tool fixtures and local Claude credential/config writers without dropping their assertions. All remaining channel-final correlation, shipped-media replay, forged-source rejection, and cleanup-order cases stay. No production or external test-support changes.

CI-only validation: plain oxlint, oxfmt, git diff --check. No test or coverage run. Shard LOC 3819 -> 3413 (10.6%); declarations 108 -> 97. Below 25%: remaining auth, approval, SDK, durability, and lifecycle contracts have no demonstrated duplicate proof. Baseline worker-preparation imports missing session-transcript.test-support.js; left unchanged for coordinator.

* test(board): avoid shadowed frame fixture after replay

* test: retain distinct boundary coverage identified in review

* test: preserve lifecycle proof and drop failing cleanup fixtures

* test(chat): retain providerless pane remount coverage

* test(plugins): retain original context engine fixture teardown
@steipete

Copy link
Copy Markdown
Contributor

Thanks @Alix-007! Your fix landed unchanged via #184153. We used a replacement because GitHub’s file-list metadata on the fork branch prevented the security workflow from completing. Your co-author credit is preserved in the landed commit.

@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @steipete for getting this landed and preserving the credit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: qa-channel Channel integration: qa-channel channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: synology-chat channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: x channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: acpx extensions: active-memory extensions: agentsapi extensions: amazon-bedrock extensions: anthropic extensions: bifrost extensions: browser extensions: byteplus extensions: canvas extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: cloudflare extensions: codex extensions: comfy extensions: copilot extensions: crabbox extensions: deepgram extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: fal extensions: fish-audio Extension: fish-audio extensions: inworld Extension: inworld extensions: kimi-coding extensions: llama-cpp extensions: llm-task Extension: llm-task extensions: lmstudio extensions: memory-core Extension: memory-core extensions: memory-wiki extensions: minimax extensions: moonshot extensions: oc-path extensions: openai extensions: policy extensions: qa-lab extensions: tavily extensions: tts-local-cli extensions: volcengine extensions: voyage extensions: vydra extensions: xiaomi gateway Gateway runtime P2 Normal backlog priority with limited blast radius. plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: cua-computer plugin: file-transfer plugin: google-meet plugin: imap plugin: knowledge plugin: logbook Logbook automatic work journal plugin plugin: mcp-relay plugin: migrate-claude plugin: migrate-hermes plugin: muse plugin: mxc plugin: onnx plugin: team-reports plugin: teams-meetings Teams Meetings plugin plugin: typesafe plugin: workboard proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.