Repository navigation
refactor(scripts): deslop scripts/lib - #159362
Conversation
|
Codex review: blocked before merge. Reviewed September 27, 2026, 7:01 PM ET / 23:01 UTC (Revision 17). ClawSweeper reviewWhat this changesThe branch consolidates Docker, CI planning, release, packaging, and reporting helpers and makes repeated config-boundary scans read current source. Merge readiness⛔ Blocked before merge - 2 items remain Current main still has the repeated script helpers and the config-scan cache defect addressed by this PR. I found no blocking code defect, but the PR description still says a closed, unmerged CI repair is pending. Priority: P3 Review scores
Verification
How this fits togetherRepository scripts turn source changes, package metadata, and runner settings into CI jobs, Docker checks, release artifacts, and reports. They support OpenClaw development and publication. flowchart LR
A[Source changes] --> D[Script helpers]
B[Package and release inputs] --> D
C[Runner settings] --> D
D --> E[CI jobs]
D --> F[Docker checks]
D --> G[Release artifacts and reports]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +38, Other -1437. Total -1399 across 70 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one owner for each script contract while preserving Docker exit behavior, CI selection, and release artifact validation. Do we have a high-confidence way to reproduce the issue? Yes for the incidental cache defect: current-main source retains text across collector calls, and the proposed regression exercises clean, forbidden, then clean source in one process. This read-only review did not execute it. Is this the best way to solve the issue? Yes. Sharing the existing script responsibilities and scoping the cache to each scan addresses the identified maintenance problem without adding a competing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f651a47ed73d. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Consolidate script lifecycle, scenario, planner, report, release and packaging helpers while retaining CLI and publication contracts. Keep config-boundary source caches within one scan so repeated in-process checks observe edits. Carry extracted helpers through selective fixtures and iOS scope routing. Leave PR tooling and its library import closure intact.
f1d52bc to
fe9d0bc
Compare
|
Landed over a pre-existing main failure (coordinator, per maintainer rule). The only failing job, checks-node-compact-large-11, failed in |
* refactor(scripts): deslop scripts/lib Consolidate script lifecycle, scenario, planner, report, release and packaging helpers while retaining CLI and publication contracts. Keep config-boundary source caches within one scan so repeated in-process checks observe edits. Carry extracted helpers through selective fixtures and iOS scope routing. Leave PR tooling and its library import closure intact. * fix(scripts): retain sanitizer fast path after helper cleanup * fix(scripts): model watchdog shell consumer in dead-code checks
…ests openclaw#158491 imports it from two infra tests after openclaw#159362 made it module-local, so the core test-types infra stripe failed on main with TS2459.
#158916) * refactor(runtime): deslop tasks, daemon, node-host and tui second pass * test(update): mock canonical systemd activation admission Keep native-start and retained-restart fixtures on the lifecycle admission owner after consolidation. Preserve real executor revocation, native command ordering and every assertion. * test(runtime): track relocated decoder suppression * test(tui): synchronize terminal fixture readiness Inspect the current completed target screen instead of cumulative terminal output. Wait for startup readiness and command publication while isolating unrelated fd discovery in the exact-argument completion fixture. * test(tui): isolate fallback projection from vendor policy loading Use distinct synthetic provider/model identities while retaining foreign-run and malformed-event rejection, exact footer replacement, unchanged backend calls, and clean exit. Include captured terminal output when the exit assertion fails. * test(tui): group session mode proof with identity fixtures Move the self-contained mode-scoping case out of the general harness to retain the line cap. Preserve every assertion, the 20-second operation budget, the 25-second test budget, and owned fixture cleanup. * refactor(runtime): reuse projection and worker dispatch values Inline the one-use row identity before keyed refresh and integrate the deferred plugin-migration write-options cleanup from main (ad31034, #159426). Preserve worker admission, transaction ownership, options, and refresh order. Also use the synchronized current screen for the sibling stale-display-name assertion without changing its timeout or cleanup. * test(tui): fence reused-session fixture transitions * refactor(ui): colocate omitted media status rendering (#159938) * fix(tui): preserve CLI lifecycle context for terminal events Bind input and resize callbacks at terminal startup so later stdin events retain the existing CLI resource host and scheduler. Keep ingress authority and shutdown ownership unchanged. Add a focused callback-context regression; the real built CLI reproduces the original MCP scheduler error and passes with the adapter. * fix(ci): keep chat attachment controls within lint limit (#160159) Move the unchanged image data-URL decoder into the existing image helper to restore the 700-line lint limit. Validated on Blacksmith Testbox: 34 attachment tests, all core lint stripes, targeted changed checks, and the UI build. Independent review found no actionable issues. * test(daemon): assert incompatible custody release diagnostics Align the four retained historical custody cases with b107d4a. Release now validates the stored generation directly rather than using the mutation-authority predicate, allowing paired cancellation settlement without hiding incompatible-row diagnostics. Require the full incompatibility error while preserving service callback refusal and exact sidecar identity, bytes, and stored-row assertions. Production behavior is unchanged. Blacksmith Testbox tbx_01m3kf15jgcthvq4f69nxn8t28: pristine main ff8c752 fails 3/3 runs with the same four failures; the fix passes 24/24 tests in each of three runs through ci-run-node-test-shard with the daemon config, agentic-command-support shard, CI=1, and two workers. Three sibling files pass 32/32 tests. The single-worker pnpm test cost is 28.05s wall including cold compiler preparation. Targeted lint, formatting, and git diff --check pass. check-changed runs but stops at pre-existing services graph TS2459 errors: package-update-activation-journal.test.ts:7 and package-update-activation-lifetime.test.ts:11 import assertReliabilityForcedExit, made private by 9491d5a. A clean baseline checkout with independent dependencies reproduces both exact errors. No unrelated fix, local validation, autoreview, or push is included; review and publication remain with the lead. * fix(node-host): retain container timeout diagnostics Restore the configured deadline and safe engine operation when runExec reports a sanitized timeout. Keep arguments and executable paths out of the diagnostic, preserve the original cause, and leave deadlines, daemon pinning, and cleanup unchanged. Reproduced the container supervisor failure on main at 8b549de. The focused file now passes all 22 cases; the full supervisor, container, and process families pass 1193 tests with 49 skips across 110 files. Core typecheck, targeted lint/format, docs syntax, and independent P2 review pass. The new four-case deterministic file takes 1.82s Vitest wall; the existing integration file takes 41.03s, with no added processes or waits. * fix(scripts): export assertReliabilityForcedExit for package update tests #158491 imports it from two infra tests after #159362 made it module-local, so the core test-types infra stripe failed on main with TS2459. * fix(ci): keep test planning within its existing budgets Apply the canonical planner repairs from #160408, #160458, #160531, and #160517 to the runtime cleanup branch. Preserve complete source facts, canonical command ownership, and the existing PR-exempt test inventory. The merged cohort passed its old-reader regression control, owner suites, scoped changed checks, and 20 full original-group repetitions on two CPUs. * test(daemon): retain canonical stale-lease release expectation Preserve #160288 when integrating main: a stale stored generation is rejected before its replacement payload is decoded, so release returns false. Keep the callback refusal and exact sidecar and database-row preservation assertions. * fix(ci): adopt canonical Doctor repair lint fix Apply #160715 so the pinned runtime branch includes the canonical repair module split. Version and cohort planning use the existing targets owner; installation retirement and transaction ordering stay with repair. * ci: refresh runtime checks after canonical contract repairs Refresh the PR merge ref after main fixed the unused 1Password dependency in 4ed0cb3 and the retired runtime API inventory in 5b76930. The runtime source tree remains cd5b525, matching the reviewed and completed Testbox proof. * ci: refresh runtime validation after main CI fixes * ci: refresh runtime checks after duplicate route repair
openclaw#158916) * refactor(runtime): deslop tasks, daemon, node-host and tui second pass * test(update): mock canonical systemd activation admission Keep native-start and retained-restart fixtures on the lifecycle admission owner after consolidation. Preserve real executor revocation, native command ordering and every assertion. * test(runtime): track relocated decoder suppression * test(tui): synchronize terminal fixture readiness Inspect the current completed target screen instead of cumulative terminal output. Wait for startup readiness and command publication while isolating unrelated fd discovery in the exact-argument completion fixture. * test(tui): isolate fallback projection from vendor policy loading Use distinct synthetic provider/model identities while retaining foreign-run and malformed-event rejection, exact footer replacement, unchanged backend calls, and clean exit. Include captured terminal output when the exit assertion fails. * test(tui): group session mode proof with identity fixtures Move the self-contained mode-scoping case out of the general harness to retain the line cap. Preserve every assertion, the 20-second operation budget, the 25-second test budget, and owned fixture cleanup. * refactor(runtime): reuse projection and worker dispatch values Inline the one-use row identity before keyed refresh and integrate the deferred plugin-migration write-options cleanup from main (13f2174, openclaw#159426). Preserve worker admission, transaction ownership, options, and refresh order. Also use the synchronized current screen for the sibling stale-display-name assertion without changing its timeout or cleanup. * test(tui): fence reused-session fixture transitions * refactor(ui): colocate omitted media status rendering (openclaw#159938) * fix(tui): preserve CLI lifecycle context for terminal events Bind input and resize callbacks at terminal startup so later stdin events retain the existing CLI resource host and scheduler. Keep ingress authority and shutdown ownership unchanged. Add a focused callback-context regression; the real built CLI reproduces the original MCP scheduler error and passes with the adapter. * fix(ci): keep chat attachment controls within lint limit (openclaw#160159) Move the unchanged image data-URL decoder into the existing image helper to restore the 700-line lint limit. Validated on Blacksmith Testbox: 34 attachment tests, all core lint stripes, targeted changed checks, and the UI build. Independent review found no actionable issues. * test(daemon): assert incompatible custody release diagnostics Align the four retained historical custody cases with 82ab893. Release now validates the stored generation directly rather than using the mutation-authority predicate, allowing paired cancellation settlement without hiding incompatible-row diagnostics. Require the full incompatibility error while preserving service callback refusal and exact sidecar identity, bytes, and stored-row assertions. Production behavior is unchanged. Blacksmith Testbox tbx_01m3kf15jgcthvq4f69nxn8t28: pristine main 5f12b85 fails 3/3 runs with the same four failures; the fix passes 24/24 tests in each of three runs through ci-run-node-test-shard with the daemon config, agentic-command-support shard, CI=1, and two workers. Three sibling files pass 32/32 tests. The single-worker pnpm test cost is 28.05s wall including cold compiler preparation. Targeted lint, formatting, and git diff --check pass. check-changed runs but stops at pre-existing services graph TS2459 errors: package-update-activation-journal.test.ts:7 and package-update-activation-lifetime.test.ts:11 import assertReliabilityForcedExit, made private by 90bddde. A clean baseline checkout with independent dependencies reproduces both exact errors. No unrelated fix, local validation, autoreview, or push is included; review and publication remain with the lead. * fix(node-host): retain container timeout diagnostics Restore the configured deadline and safe engine operation when runExec reports a sanitized timeout. Keep arguments and executable paths out of the diagnostic, preserve the original cause, and leave deadlines, daemon pinning, and cleanup unchanged. Reproduced the container supervisor failure on main at 2d04b95. The focused file now passes all 22 cases; the full supervisor, container, and process families pass 1193 tests with 49 skips across 110 files. Core typecheck, targeted lint/format, docs syntax, and independent P2 review pass. The new four-case deterministic file takes 1.82s Vitest wall; the existing integration file takes 41.03s, with no added processes or waits. * fix(scripts): export assertReliabilityForcedExit for package update tests openclaw#158491 imports it from two infra tests after openclaw#159362 made it module-local, so the core test-types infra stripe failed on main with TS2459. * fix(ci): keep test planning within its existing budgets Apply the canonical planner repairs from openclaw#160408, openclaw#160458, openclaw#160531, and openclaw#160517 to the runtime cleanup branch. Preserve complete source facts, canonical command ownership, and the existing PR-exempt test inventory. The merged cohort passed its old-reader regression control, owner suites, scoped changed checks, and 20 full original-group repetitions on two CPUs. * test(daemon): retain canonical stale-lease release expectation Preserve openclaw#160288 when integrating main: a stale stored generation is rejected before its replacement payload is decoded, so release returns false. Keep the callback refusal and exact sidecar and database-row preservation assertions. * fix(ci): adopt canonical Doctor repair lint fix Apply openclaw#160715 so the pinned runtime branch includes the canonical repair module split. Version and cohort planning use the existing targets owner; installation retirement and transaction ordering stay with repair. * ci: refresh runtime checks after canonical contract repairs Refresh the PR merge ref after main fixed the unused 1Password dependency in 3b5b7e1 and the retired runtime API inventory in 1ed57fc. The runtime source tree remains cd5b525, matching the reviewed and completed Testbox proof. * ci: refresh runtime validation after main CI fixes * ci: refresh runtime checks after duplicate route repair
What Problem This Solves
scripts/librepeats scenario rendering, process lifecycle handling, release metadata parsing, and report projection across parallel helpers. Those copies make contract-preserving maintenance harder and have required the same fix in multiple places.User Impact
CLI flags, environment precedence, output formats, exit codes, test selection, release/publish behavior, and signing choices remain unchanged. Config-boundary scans now observe source edits made between invocations in the same process.
Why This Change Was Made
agents.listprojection and exact shell output.Fixes found along the way
Config guards kept a module-global source cache, so a second scan could miss a newly introduced forbidden config call or retain a removed violation. The cache now belongs to one scan. Two regressions exercise clean → forbidden → clean source through both public collector entrypoints.
The computed PR-tooling import closure contains 96
scripts/libfiles. None are changed;scripts/prandscripts/pr-libare untouched. No package boundary imports were added.Evidence
Measured diff: 1,437 net production/tooling lines removed, with 38 net test/support lines added. All production files over 200 lines in the eligible subtree were read; the protected import closure was excluded from edits.
Blacksmith Testbox proof includes:
node scripts/check-changed.mjs,pnpm build,pnpm check:workflows, script/test lint, full dependency/unused-file/unused-export scans, macOS script contracts, and all selected typecheck lanes pass on Testbox. The final Knip caller registration also passed its focused changed gate and independent review.relevantBuildUploadsalready validates every relevant record before calculation: both baseline and candidate rejectabc,1.5,0,-1, and unsafe integers, while preserving whitespace-normalized allocation. No accepted findings remain.Changed-test cost on Testbox (
pnpm test <file> --maxWorkers=1, wall seconds):config-boundary-guard.test.tsandroid-version.test.tsplugin-npm-security-scan.test.tsvitest-pair-benchmark.test.tsdocker-build-helper.test.tspreflight-frozen-target-contracts.test.tsmobile-release.test.tsci-changed-scope.test.tsThe two existing suites above 30 seconds exercise process cleanup and frozen-checkout authority. Their only changes add the new companion to existing fixtures; no test cases were added to those suites. The new behavior regressions use existing lightweight suites.
The first changed-file gate exposed pre-existing cron fixture type errors, fixed on main by
c0e6951d6f0; the branch was refreshed onto that repair. Subsequent checks caught and corrected selective fixture acquisition, type-contract, and dead-export issues. A later rebase introduced a sanitizer fast-path reference to the retired constant; focused tests reproduced it and the correction preserves the upstream fast path. Hosted CI additionally required the source-derived Knip caller registration. No assertions, security checks, retries, or timeout budgets were weakened.The previous hosted run failed during cron fixture removal (
ENOTEMPTY) and cancelled its remaining jobs. Current main already contains the scoped database cleanup repair and held-worker regression in #159182 (e1e4e6981cb). This branch was rebased onto3faf686bde3;git range-diffconfirms all three refactor commits are patch-identical. The incorporated regression proves settlement before removal and sibling-store isolation; passing replays alone do not establish the exact cause of the intermittent hosted failure.Current-head CI run 36304153515 is blocked by an inherited suppression-guard failure:
native-subagent-monitor.test-support.ts|typescript/unbound-method|1was introduced on main by #159325 but is absent from the explicit allowed tail. Neither the helper nor the guard is changed here. The separately owned repair in #159550 now covers this exact failure without widening the suppression allowlist. Its current head isaa0ea90cd7cbb3cad24d0fd573cc506028d8bb6a; the required CI gate is green. This refactor awaits that repair landing, then a rebase and fresh hosted CI. Other jobs were cancelled by fail-fast, so this run is not a passing full gate.The original four hosted job groups passed across the resumed Testbox replay (4,166 passed tests, two skips). The exact cron shard passed all 130 files / 1,453 tests, followed by 20 consecutive Linux iterations of the 18 reaper and scoped-cleanup cases (360 passes). The first replay stopped on an incorrect carrier-commit assertion before any tests; the next lacked CI’s Bun executable. The final replay used the workflow’s checksum-pinned Bun runtime and exited 0. Provider:
blacksmith-testbox; stopped lease:tbx_01m3gx6zqyqe4cfsn50gntyzdv; Testbox run. Commands: the originalci-run-node-test-shard.mtsgroup envelope, then 20 sequentialrun-vitest.mjsinvocations forservice.session-reaper-in-finally.test.tsandservice.test-harness.test.ts.