Repository navigation
refactor(commands): share command validation and diagnostic paths - #167783
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. |
|
Coverage log, part 1 of 2. Per-file implementation and retention decisionsCommands P2 per-file coverageInitial coverage inventory:
|
|
Coverage log, part 2 of 2. Per-file implementation and retention decisionsCommands P2 per-file coverageInitial coverage inventory:
New shared cores: Measured and rejected experiments: shared binding builder (+5 LOC), shared Doctor worker lifecycle (+1), backup output callback (-12 but generic plumbing), and common memory-provider projection (-8 but changed pre-close field capture). ES2024 Set/grouping candidates were rejected under the repository ES2023 target. |
|
Codex review: needs maintainer review before merge. What this changesThis PR consolidates repeated command validation, model selection, and Doctor diagnostics while preserving existing CLI output and repair behavior. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep open: this is useful internal maintenance with no concrete correctness defect found. Current main retains the paths being consolidated, and the earlier merged cleanup does not supersede this work. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherOpenClaw commands translate operator requests into configuration updates, Gateway requests, and diagnostic reports. Doctor inspects existing configuration and stored sessions, then delegates approved repairs to their existing storage owners. flowchart TD
A[Operator CLI request] --> B[Command dispatch]
B --> C[Shared validation and model selection]
B --> D[Doctor diagnostic collectors]
C --> E[Existing configuration and Gateway owners]
D --> F[Read-only transcript inspection]
F --> G[Existing guarded repair transactions]
E --> H[CLI results and diagnostics]
G --> H
Technical reviewBest possible solution: Keep shared mechanics in the existing command owners while preserving command-specific output, consent, and repair transactions. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving consolidation rather than a reported product defect. Is this the best way to solve the issue? Yes: the diff removes parallel internal handlers and shares existing mechanics without introducing competing state owners or public configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 10b767dc090c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 9, 2026, 7:13 AM ET / 11:13 UTC. |
|
Exact-head CI attribution for The I reproduced the same failure with CI tested merge Four initial zero-step The second failed check is Final paginated check-run census: 222 completed checks: 97 success, 122 conditional skips, one neutral, two failures attributed above; zero pending or cancelled checks. CI run The exact-source local/remote proof recorded in the PR passed, including all 7,653 commands tests (four existing platform skips), focused/E2E tests, changed checks, zero runtime/static cycles, and an unchanged Plugin SDK API. Under the coordinator's standing inherited-main-failure rule, this PR is ready for a squash merge pinned to the reviewed head. No test, ignore, timeout, budget, or suppression was weakened, and no inherited main fix is included. |
What Problem This Solves
Commands repeat model selection, authentication diagnostics, transcript inspection, and CLI dispatch logic across closely related operations.
User Impact
There is no user-visible change. CLI flags and output, configuration and protocol fields, persisted data, repair authority, and cleanup/error ordering remain unchanged. No migration or operator action is required.
Why This Change Was Made
Share model setters and probe configuration with explicit text/image and credential parameters; share unavailable-profile facts while retaining each command's output projection; share transcript scanning and snapshot comparison while leaving repair transactions with their existing owners. Smaller consolidations remove duplicate command dispatch, credential processing, platform warnings, and diagnostic projections.
This is the second commands pass after #167043. The initial inventory covered 460 production files and 97,801 lines; the additional platform module extracted on main was also inspected. Earlier rejected candidates were reconsidered, implemented, and measured. Experiments that added indirection or obscured lifecycle/output differences were removed. The per-file coverage log is attached in two comments.
The committed diff removes 610 net production lines, excluding tests, fixtures, support, generated files, and declarations. Tests/support add 44 lines; nine obsolete mock-baseline rows are removed and the assertion allowance shrinks from two to one. This uses the campaign's authorized 500–999-line coverage-log route after the completed deep pass and main integration.
Evidence
Source:
e9ef52146778849b7904ee56b0cc861098b2468d, tree456d05f3c93fe75f27587ccefac5751f2f27c39d, based onf02f2de695169db662dae961fc5c19951f0f4a28.runDoctorStateSqliteCompact, retains its signature, defaults, body, and behavior. Landing tooling and its scripts helpers are unchanged.src/commandsdirectory passed: 640 files, 7,653 tests, and four existing platform/path-alias skips; 2,305.35 seconds wall time.--maxWorkers=1: 355 tests, no skips, 322.55 seconds wall time and 470.34 CPU seconds. This is measured remote test cost; hosted CI duration is separate.Remote proof ran on Hetzner lease
cbx_e6628f0492aa: https://crabbox.openclaw.ai/portal/runs/run_ed68743da0e4bddca1ee0b5854cfb790. Its verified source tree exactly matches the authored commit; the capsule transport commit is not presented as the PR head.