Repository navigation
refactor(commands): deslop commands sixth pass - #161202
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 5:34 PM ET / 21:34 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch consolidates CLI formatting and Doctor repair logic, adjusts status tests, and removes redundant command code while aiming to preserve existing behavior. Merge readiness⛔ Blocked before merge - 5 items remain Keep open. Current main does not contain this cleanup, and the merged fifth pass is distinct. No definite introduced defect was established, but compatibility of the remaining state-writing Doctor changes through an update is unproven. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw command handlers receive CLI options and read configuration and local state. Doctor can repair stored configuration, cron jobs, and sessions, while status and agent commands render operator-facing results. flowchart LR
A[CLI request] --> B[Command handlers]
C[Configuration and local state] --> B
B --> D[Doctor repair decisions]
B --> E[Status and agent output]
D --> F[Updated stored state]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one Doctor repair path that preserves existing config, cron, and transcript semantics, including recoverable warnings and backups, across a published-version update. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor reports no existing-behavior bug. CLI help comparisons do not exercise Doctor repairs during an update. Is this the best way to solve the issue? Unclear: consolidation fits the existing command owners, but the state-writing portion needs upgrade compatibility evidence before its safety can be judged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 14398941a104. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
Consolidate command formatting, migration traversal, and result projections while preserving CLI behavior, output, exit codes, Doctor migrations, and config writes. Remove redundant private plumbing and narrating comments; shrink only the matching assertion baseline entries.
6517898 to
4ece9d4
Compare
Restore six shared Doctor modules byte-for-byte to main so the commands reduction no longer changes modules eagerly imported by the failing runtime CI paths. Keep the remaining cleanup and all existing test assertions. The original nine CI candidates pass on main and the rebased PR. Clean-main replays separately reproduce 19 of 21 later CI failures; two remain unreproduced. The narrowed source still requires its pre-push checks and CI. Fresh isolated review through P2 found no actionable defects in this delta.
Consolidate command formatting, migration traversal, and result projections while preserving CLI behavior, output, exit codes, Doctor migrations, and config writes. Retain shared runtime implementations unchanged and remove 993 net production lines. All nine original CI candidates pass on clean main and the rebased PR. Exact-source Testbox checks pass, including both zero-cycle checks, changed checks, and 1,179 plugin contract tests. Independent review found no actionable findings. CI attribution and retained main-failure evidence are recorded in the PR body.
What Problem This Solves
Continues the maintainer-requested commands cleanup by removing duplicate result projections, migration traversal, and formatter plumbing left after the fifth pass.
User Impact
No intended user-visible change. Command behavior, flags, output text, exit codes, Doctor migrations, and config writes retain their existing contracts. There are no new settings, schema changes, or operator actions.
Why This Change Was Made
The existing owners can express these flows with less parallel implementation and fewer forwarding layers. Production code is 993 lines smaller; tests and support retain their assertions and add 10 net lines. The sweep started from fresh main, read the recent subtree change names including #159817, and covered every production module, including all 242 files over 200 lines.
Simplifications and rationale
Evidence
Narrowed candidate
Current candidate:
f90a7eb4ae2dc3d1cf87f7a28a84f568890233e5, source treee4040f9434069acf15c1c90b247f45a431b1ea82. The cleanup retains 993 net fewer production lines, with 10 net added test/support lines and one fewer baseline line.Six shared files are restored byte-for-byte to main:
doctor-command-owner.ts,doctor/shared/legacy-tool-name-migration.ts, anddoctor/shared/legacy-config-migrations.runtime.{retired,tier-eval,models.vllm,tool-policy-conflicts}.ts(all undersrc/commands/). Runtime import analysis found these files eagerly loaded by the later failing CI tests. The remaining diff has no changed eager import in those 13 failing-file paths, including top-level awaited fixture imports and partial mocks; the examined failing flows do not enter the conditional legacy-cron repair path. This narrows the refactor without modifying the unrelated runtime tests.Fresh isolated Codex autoreview through P2 on the six-file withdrawal: scoped-clean, no actionable findings.
Pre-push checks on this exact narrowed source passed on Linux Blacksmith Testbox: madge 0 cycles, runtime imports 0 cycles, all nine candidate files 36 tests passed, plugin contracts 50 files / 1,179 tests passed, and every selected
node scripts/check-changed.mjs --base origin/main --timedgate passed, including all 27 test-type shards. Providerblacksmith-testbox, leasetbx_01m3qdk4zn7jj0mkt4prykc7sf, host workflow 36626442905. The source checks completed; the wrapper subsequently reported a provider timeout during lease cleanup, so its overall exit 1 is recorded separately from the passing checks. Both provider status and stop APIs timed out; the owned host workflow was then cancelled and confirmed completed to release the runner.Landing blocker (2026-09-29, 21:24 UTC): exact-head CI run 36630774659 is attached to
f90a7eb4ae2dc3d1cf87f7a28a84f568890233e5, but preflight job 109619144977 remains queued before checkout: no assigned runner and no steps, after about 20 minutes. It requestsblacksmith-16vcpu-ubuntu-2404. A newer unrelated PR's preflight (36631372288/109621164290) has the same unassigned shape; Blacksmith Testbox status and stop API calls also timed out. The control-plane errors and Actions assignment wait are separate observations, not proof of a specific provider root cause. No repository or test failure has been reported on this head. The precise CodeQL scan is also queued.Pinned squash auto-merge is armed; the PR is open and mergeable but not merged. Pending/unexecuted CI does not qualify for the pre-existing-failure exception. No admin merge was attempted, no failing test was waived, and no CI run was restarted. The earlier-head results below remain historical evidence, not a current-head pass or merge qualification.
Original candidate settlement after rebase
Rebased without conflicts onto main
38dd3c28dd42f8c853f35b37ac688c4701bcf474; candidate head4ece9d4193992bcc8f6774cbe12fda04d08ef88a, verified source treeec395e59118c073bc6282abfa19c9145fd1a3ac8.git range-diffconfirms the original reduction is patch-identical, so its prior P2 autoreview remains applicable; there is no new corrective delta.The nine suspected PR-owned files all passed on both clean main and the rebased candidate: 9 files / 36 tests per revision. Classification: resolved by rebase for every candidate; no tests, assertions, or behavior were loosened.
src/commands/status-json.test.tsmodel-picker.default-agent.test.tsmodel-picker.provider-menu.test.tssessions.kind-classification.test.tssetup.doctor-recovery.test.tsdoctor-state-integrity.order.test.tsdoctor-config-preflight-plugin-verification.test.tsdoctor-config-preflight.plugin-action-inventory.test.tsdoctor-config-preflight.legacy-owner.process.test.tsThe old CI failures were snapshot-cleanup/read-admission cascades, including an unexpected
updateRunStatus.runStatusErrorin status JSON. The new base includes main's7b64dadaeeb43212fb23787feaf8722f56a45032snapshot-cleanup custody repair. The focused replay establishes the current candidate result; it is not a claim that every old shard was replayed.Comparison command:
CI=1 node scripts/run-vitest.mjs <the nine files above> --reporter=verbose, with a detached clean main worktree and frozen dependency install on the same Linux Blacksmith Testbox. Main wall time: 49.88 s; candidate: 47.99 s. Providerblacksmith-testbox, leasetbx_01m3q7cxr57hgymhk75mm8er86, host workflow 36613551912. Wrapper source verification and command exit 0 passed.Pre-push proof on this exact source passed:
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.tsreported 0 cycles;node --import ./scripts/tsx.mjs scripts/check-import-cycles.tsreported 0 runtime value cycles;node scripts/check-changed.mjs --base origin/main --timedpassed all selected gates; andnode scripts/run-vitest.mjs src/plugins/contractspassed 50 files / 1,179 tests. Providerblacksmith-testbox, leasetbx_01m3q72b1c8pnepsb89qh4s0ya, host workflow 36612859757. The remote command exited 0; both task leases were stopped after success. Testbox workflow cancellation during lease cleanup is not a test failure.The previous CI run 36616587292, head
4ece9d4193992bcc8f6774cbe12fda04d08ef88a, tested mergeb3346cfb0a34c9856e7b5d8c1026c2e984f3ba67with mainbda22f818d967ffa3551b3a729d5bc43863844c7. It finished with 9 originating failed jobs (13 files / 21 cases), plus the aggregate gate; 124 jobs passed, 20 skipped, and none were cancelled.A clean-main replay at that exact main parent reproduced 19 of the 21 cases with matching assertions/errors, across 11 files. It retained the ten original failing Node groups (316 files, their configs and worker settings) and ran the unchanged failing UI file after installing Chromium. Provider
blacksmith-testbox, leasetbx_01m3qafdkgwz7zsa65qzyyr2jf, host workflow 36620000716. Expected and actual values, booleans, nulls, timeout duration, and missing exports matched; only log transport, temporary paths, timestamps, and UUIDs were normalized.The cancellation-publication case also failed identically on newer main
d8d0e9c990ea8006fdf8907d9e4972dbf452372b, hourly run 36619831492, job 109582556671: expectedkilled=true, cascadeKilled=1, receivedfalse, 0. That establishes main evidence for 20 of the 21 previous-head cases. The heartbeat different-store case passed its clean-main group and remains unqualified; a passing replay is not a fix. The narrowed head requires its own CI result before any merge decision.Main-owned failures observed on the earlier head
These are historical results from CI run
36616587292, not failures asserted for the pending narrowed-head run. Unless noted otherwise, the matching clean-main proof isbda22f818d967ffa3551b3a729d5bc43863844c7on Testbox host run36620000716.109571805947src/cron/service/ops.mutation-completion.test.ts109571805947src/cron/service/owner-hardening.test.tsCronJobsStoreChangedErrorrejects an expected resolution.109571805947src/cron/service/shared-store-runtime.test.ts109571806004src/agents/subagents/registry/subagent-registry-task-replacement.test.tsinvalid-event.109571806074src/cron/isolated-agent/delivery-dispatch.double-announce.test.tscountPendingDescendantRuns.109571806074src/agents/subagents/registry/subagent-registry.store-replaced.test.ts109571806118src/agents/subagents/registry/subagent-control.publication.test.tstrue/1, gotfalse/0; matched hourly main run36619831492, job109582556671.109571806152src/agents/subagents/registry/subagent-control.test.ts109571806152src/agents/subagents/registry/subagent-control.retirement.test.ts109571806384src/gateway/server-reload-handlers.test.ts[7200000,3600000], got[7200000,7200000].109571812144src/cli/update-cli.target-schema.test.ts109571802330ui/src/e2e/initial-connect-splash.e2e.test.tsThe separate heartbeat follow-up failure (
src/gateway/server.heartbeat-store-lifecycle.product-proof.test.ts, job109571806771) remains unqualified: expectedagent.waitstatusok, goterrorbefore store replacement. It did not reproduce on clean main. No inherited-failure exception applies to that case without further evidence. A subsequent check of all 22 failure annotations across the eight failed Node jobs in latest hourly main run36627294336(5a674c5c87b95261991381d99cc385c3fe5f0ac9) found no matching heartbeat case; absence from those annotations is not a passing test result or a repair.Retained proof for the unchanged reduction
All execution proof ran on Linux Blacksmith Testbox, with the repository wrapper verifying the base and source tree. No tests, lint, typechecks, or builds ran on the shared Mac.
node scripts/check-changed.mjs --base 98e3f67d93b8348f0c166ae9975703e5ad0fd287 --timed -- <changed paths>passed all selected gates, including core/test type graphs, lint, Knip, import cycles, and storage/pairing guards. Final targeted lint also reported zero warnings/errors across 136 TypeScript files.node scripts/run-vitest.mjs src/commands src/cli <Doctor-flow and backup importers>passed 9 shards: 1,187 files and 19,073 tests passed, with 4 existing file skips and 67 existing test skips. The full CLI selection includes every shared expected-error predicate hit found acrosssrc/cliandsrc/commands.*import-boundary.test.tsselectors, includingsrc/infra/fs-safe-import-boundary.test.ts, plus normalization-core package export tests passed across 9 shards.pnpm buildpassed on the original candidate and clean base. Nineteen realpnpm openclaw … --helpcaptures were compared after both full builds. Options, descriptions, and examples are identical; the only raw differences are expected revision hashes in four banners. All help commands exited successfully, and source SHA-256 checks passed before and after the builds/captures.The declaration build caught an unsupported
Map.groupByuse and a lost TypeScript narrowing local; both were corrected. Lint findings were corrected without changing settings or suppressions. Only this lane's two assertion-baseline decreases are included. The initial help fixture used unequal build preparation; the final comparison uses full builds for both revisions.Test cost and remote proof provenance
Changed test cases are retained. One-worker wall measurements (
pnpm test <file> --maxWorkers=1, paths undersrc/commands/):status-overview-rows.test.tsstatus-overview-values.test.tsstatus.command-sections.test.tsstatus.command-report.test.tsstatus.agent-local.test.tsCold transforms account for up to 97% of these standalone runs. The retained test bodies check report ordering, empty-state output, row values, and agent projection in milliseconds; no new process or timer fixtures were added. The hosted CI attempt was cancelled by fail-fast before complete changed-test timings were available; the standalone Testbox costs above are the retained measurements.
blacksmith-testbox,tbx_01m3p57tedabjbghghk5209jz8, host workflow. Full suite wall: 3,605.31 s; boundary batch: 115.14 s.blacksmith-testbox,tbx_01m3pawm3szhqwsprssz6bpzw6, host workflow. Changed checks: 1,808.30 s; final corrective replay: 42 s.blacksmith-testbox,tbx_01m3pj7zh5rn179cby9azz3c36, host workflow. Candidate build: 367.56 s; base build: 403.27 s.These are remote command results; host workflows can show cancelled when a lease is stopped. The source tree verified for this original reduction proof was
15270a9b93188b308c3702b24a09d483366618bc. Earlier full-suite evidence is retained for unchanged code, with affected suites replayed after the compiler/lint corrections.Fixes found along the way
No separate runtime or test repair is included. Shared runtime files were withdrawn from the reduction; inherited main failures and the remaining unqualified case are recorded above.