Repository navigation
refactor(cli): reuse function-shaped lazy loaders - #131144
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 3:40 PM ET / 19:40 UTC. ClawSweeper reviewWhat this changesThe PR removes forwarding wrappers around lazy dynamic imports in three CLI modules by using the existing function-shaped lazy-promise API directly. Merge readinessKeep open: current main does not contain this cleanup, and direct inspection found the wrapper-to-function replacement preserves the shared lazy-loader contract with no actionable regression. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherOpenClaw’s CLI lazily imports status, gateway, and routed command implementations after command parsing. These loaders keep startup light while supplying the modules that produce CLI output or perform gateway diagnostics. flowchart LR
A[CLI invocation] --> B[Command registration]
B --> C[Lazy module loader]
C --> D[Dynamic command module]
D --> E[Gateway or daemon action]
E --> F[CLI output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -101. Total -101 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the focused refactor after exact-head checks complete, retaining createLazyPromise as the single function-shaped lazy-loading contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor, and source comparison establishes that the former wrappers only delegated to the same canonical loader. Is this the best way to solve the issue? Yes: direct use of createLazyPromise removes adapter-only code while preserving the underlying loader owner, cache behavior, and dynamic-import callbacks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a509254b16ea. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landing verification for bc57acb: exact-head CI and the required The latest ClawSweeper review has no actionable findings or Rank-up moves. Its separate 30-second smoke expectation expired during The cleanup removes 101 net production lines by using the existing function-shaped lazy promise helper for 22 private loaders; tests, CLI flags, and public behavior are unchanged. |
|
Merged via squash.
|
What Problem This Solves
The gateway, daemon-status, and routed CLI paths repeat private forwarding functions around lazy import loaders even though the shared lazy-promise owner already exposes the same function-shaped API. This maintainer-requested cleanup removes that unnecessary indirection.
Why This Change Was Made
Use the existing
createLazyPromisefor all 22 forwarding-only loaders across these three owners. Deferred imports, cached promise identity, concurrent-load deduplication, and rejection eviction still use the unchanged canonical implementation. Remove five private type aliases used only by those wrappers.The refresh preserves the local-port selection and authentication behavior from #130847 (gateway status leaf-port handling); daemon service registration is untouched. Production LOC: +25/-126, net -101. Tests: +0/-0. No new helper, compatibility path, flag, configuration, or dependency.
User Impact
No user-visible behavior change. Commands, options, output, startup laziness, and retry behavior remain the same. This is an AI-assisted internal refactor requested by the maintainer.
Evidence
Linux provider:
blacksmith-testbox; leasetbx_01m128grx6q7501h6jyj093r0b; proof workflow. The managed command completed with exit code 0 before explicit lease cleanup; the linked workflow can show cancellation after the lease is stopped. Exact proof base:19d61d9ada04b5b9af24efc444f7bd05c53b82c0. Candidate patch SHA-256:87223049862215602503de4b02eac8a99128794c17a0708db15ccfb471d3a7e7. Collected evidence archive SHA-256:f7f0e6f0089e6d51364222effe619df86728f23e826664331e05f4b2e469c6ac.Focused command on both Linux versions:
Candidate gate/build commands in the isolated Linux worktree:
The changed-gate environment flag is the wrapper's delegation-loop guard, not a skipped check. Built-CLI proof covers read-only commands only; it does not claim installation or service lifecycle validation.