Repository navigation
refactor(commands): deslop commands - #158487
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 26, 2026, 3:19 AM ET / 07:19 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch consolidates CLI and Doctor command flows, deduplicates session lifecycle requests, repairs malformed legacy media migration, and aligns plugin identity checks with the artifact selected for execution. Merge readiness⛔ Blocked before merge - 8 items remain Keep open. Current main lacks distinct changes from this PR. The reported Doctor run and green exact-head CI support the patch, but the prior review’s final-write authority and published-updater compatibility proof requests remain unresolved. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw commands take CLI options, configuration, and stored state to run Doctor repairs and Gateway session operations. Conversational setup also uses a plugin artifact identity check before persistent changes. flowchart LR
A[CLI options and config] --> B[Command handlers]
C[Legacy state] --> D[Doctor repair]
B --> D
B --> E[Gateway session requests]
D --> F[Persisted state]
G[Plugin runtime files] --> H[Inference owner check]
B --> H
H --> F
Before merge
Findings
Agent review detailsSecurityNeeds attention: The changed plugin identity feeds a persistent authority check; rejection of a replaced owner at the final write remains unproven. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the command and plugin owners consolidated while preserving CLI contracts, current owner authority, and existing state across fresh installations and upgrades. Do we have a high-confidence way to reproduce the issue? Not applicable to the cleanup as a whole. Source and regression cases identify the included session and media defects, but this read-only review did not run a failing current-main reproduction. Is this the best way to solve the issue? Yes in approach: the branch reuses existing command and plugin owners. Its merge safety still needs final-effect authority and installed-state upgrade evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 833face0415a. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What 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)
|
289f720 to
ae3ee33
Compare
Consolidate command orchestration, Doctor migration traversal, status projection, and migration selection while preserving CLI contracts. Repair malformed legacy media rows and align inference owner fingerprints with runtime artifact selection.
Normalize session keys once before describe and mutation so repeated arguments cannot cause false partial failures. Preserve public error formatting and optional auth fields while resolving the final cleanup lint findings.
Read the existing bound artifact preference through the canonical runtime-state getter so extracted maintainer wrappers do not import runtime preparation and logging. Preserve the current writer, selection policy, and wrapper inventory.
ae3ee33 to
0e943b3
Compare
* refactor(commands): deslop commands Consolidate command orchestration, Doctor migration traversal, status projection, and migration selection while preserving CLI contracts. Repair malformed legacy media rows and align inference owner fingerprints with runtime artifact selection. * fix(commands): handle duplicate session lifecycle keys Normalize session keys once before describe and mutation so repeated arguments cannot cause false partial failures. Preserve public error formatting and optional auth fields while resolving the final cleanup lint findings. * fix(plugins): keep artifact identity on lightweight runtime state Read the existing bound artifact preference through the canonical runtime-state getter so extracted maintainer wrappers do not import runtime preparation and logging. Preserve the current writer, selection policy, and wrapper inventory.
What Problem This Solves
The command subsystem still repeats migration traversal, command orchestration, and output projection after the earlier cleanup passes. This third pass removes 1,879 net production lines while retaining the existing command contracts.
User Impact
The cleanup preserves command names, flags, help text, JSON shapes, exit-code conventions, config keys, and Doctor repair order. Three accompanying fixes prevent duplicate session deletions from reporting false partial failures, skip malformed legacy media-model entries during migration, and keep unchanged plugins valid when runtime selects source artifacts.
Why This Change Was Made
This accumulates the sound simplifications found while reading the production subtree, largest files first. It builds on #156622 and #156931 without recreating their consolidations.
Fixes found along the way
Repeated or whitespace-equivalent session keys caused repeated delete RPCs and a false partial failure after a successful deletion. Archive/delete now normalize unique keys once at command entry, retaining first-occurrence order. The existing artifact-preservation regression includes duplicate arguments and asserts one describe, one delete, and no failure exit.
Retired media migration compared
getRecord()withundefined, although invalid records producenull. The canonical record predicate now excludes malformed entries; a regression covers mixed invalid and valid lists.Plugin runtime fingerprinting had a hard-coded built preference while source-mode inference executed source. The original guided onboarding suite reproduced four failures on the starting base; a passive observer confirmed the built-to-source fingerprint switch. Upstream fix(test): restore CLI and Doctor release-validation contracts #157780 subsequently aligned that release fixture with packaged artifacts. The separate loader regression in this PR protects real source/build policy and explicit source overrides. Verification now consumes the runtime preference and the canonical explicit-source selection fact, and continues hashing selected content to reject real replacements. Fingerprinting reads that preference through the existing lightweight registry-state reader, keeping extracted maintainer wrappers free of runtime-preparation and logging imports. No stored metadata or config schema changes.
Corrects the sandbox CLI page:
agent execpreserves an inherited/configured sandbox. Configless modes use the sandbox-off default, as the existing implementation and tests already establish.Evidence
Current candidate:
0a209ea3142843a383fb23d4cf586d276603a0df. Exact-head CI passed: 169 checks successful, 45 conditionally skipped, includingopenclaw/ci-gate. The PR is mergeable and ready to land; it remains unmerged with auto-merge disabled. Independent review completed through P2 with no actionable findings. The diff removes 1,879 net production lines across 112 production files; all 619 starting production files were read, including every file over 200 lines. No shared expected-error predicate changed.Complete remote proof passed on
d08fcdae0de8b4cae54c9471ccc6b4f92d5edcbe(tree5b7a200c966360a47989e375ca13affa8caec28d). The final upstream integration preserves all 122 changed source/documentation files byte-for-byte and the exact assertion-baseline removals. The successful hosted CI run validates that integration. The refresh also retains upstream TaskFlow Webhooks retirement and its restrictive-allowlist repair unchanged; the obsolete allow/deny consolidation was removed from this PR.Remote proof used Blacksmith Testbox
tbx_01m3e42r07kvfeew5g3skp83fnthroughnode scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --id <lease> --timing-json, with source/tree attestation andpnpm install --frozen-lockfile. Every command phase and the wrapper returned zero. The lease is stopped.node scripts/check-changed.mjs --base origin/main: passed in 25m 27s, including core types, all 25 test-type shards, lint, dead exports, and boundary/schema guards.pnpm build: passed in 8m 51s.pnpm plugin-sdk:check-exportsandpnpm plugin-sdk:surface:check: passed in 1s and 3s.node scripts/run-vitest.mjsselection: 350 files, 6,667 tests passed, 3 existing skips, 16m 2s. This includes command callers, migration/lifecycle siblings, plugin artifact/inference consumers, the extracted-wrapper contract, and guided onboarding E2E.pnpm openclaw doctorandpnpm openclaw doctor --fix, both non-interactive against isolated synthetic legacy config: exit zero in 6s and 5s. Persisted assertions confirm canonical agent entries, the idle-reset policy, removal of malformed media rows, and valid model order/capabilities. The isolated diagnostic invocation correctly reported its absent Gateway.The media, artifact-preference, and duplicate-session regressions failed before their respective fixes. Initial hosted CI also exposed an eager import into the extracted maintainer wrapper. Reading the existing lightweight registry-state owner fixes that boundary; the unchanged extraction contract now passes all 15 tests (16s standalone). The extraction test and its production inventory remain unchanged.
Two upstream failures encountered during integration already have canonical repairs: da8149b8ba7d corrects the retained-assets UI E2E type import (the exact type graph subsequently passed in 48s), and 66b812f26e72 removes a chained assertion introduced on main in Gateway progress normalization. The latter broke the previous CI merge ref; this branch incorporates its repair, and fresh CI passed. Neither failure required a duplicate fix PR.
Changed-test cost
Serial wall time was measured on the validated Testbox source with
pnpm test <file> --maxWorkers=1; the media E2E uses the already-built distribution. CI seconds come from the successful current-head run and sum Vitest's reported case durations, excluding shared runner setup; zero reflects the logger's timing resolution.src/commands/channels.adds-non-default-telegram-account.test.tssrc/commands/status-all/channels.mattermost-token-summary.test.tssrc/plugins/plugin-runtime-artifact-resolution.test.tssrc/system-agent/verified-inference.test.tssrc/commands/migrate/selection.test.tssrc/commands/sessions-lifecycle.test.tssrc/commands/doctor/shared/legacy-config-migrate.e2e.test.ts