Repository navigation
fix(cli): keep setup and agent help startup lazy - #133272
Conversation
Defer onboarding rejection and agent finalization imports until actions execute. Split agent-exec input/config preparation and result projection into actual production owners while preserving helper bodies and test contracts. Production LOC stays neutral.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:34 AM ET / 11:34 UTC. ClawSweeper reviewWhat this changesThe PR defers setup, onboarding, and agent action imports until command execution, and moves agent-exec input/config and result-projection helpers into focused modules. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-authored PR open for normal landing review. The introduced lazy boundaries repair the linked cold-help regression without a concrete correctness or security defect found; exact-head hosted checks are still pending. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s CLI command registrations must render help without initializing action runtime. When a user actually invokes setup, onboarding, or an agent turn, the registration hands execution to runtime-backed command owners. flowchart LR
A[CLI invocation] --> B[Command registration]
B --> C[Help renderer]
B --> D[Action handler]
D --> E[Deferred runtime imports]
E --> F[Setup, onboarding, or agent execution]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +9, Other 0. Total +8 across 13 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the deferred action-import boundaries and land after exact-head CI completes; no additional code change is indicated by this review. Do we have a high-confidence way to reproduce the issue? Yes—source provides a high-confidence reproduction path: the existing cold-help test targets the static registration imports present on the PR base, though this read-only review did not execute it. Is this the best way to solve the issue? Yes—the action callbacks are the correct ownership boundary for runtime-only imports, while the moved agent-exec helpers preserve their existing callers and focused tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4306140e0b88. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* fix(cli): keep command actions out of help registration Defer onboarding rejection and agent finalization imports until actions execute. Split agent-exec input/config preparation and result projection into actual production owners while preserving helper bodies and test contracts. Production LOC stays neutral. * refactor(cli): complete agent exec owner migration
Closes #133271
What Problem This Solves
Resolves a problem where CLI help registration loads action-only runtime code before a command runs. Existing cold-help checks fail for
setup,onboard, andagents; the same agent registration path also affectsagent --helpandagent exec --help.Why This Change Was Made
Move onboarding rejection handling and agent exit finalization behind the existing async action boundary. Await the registration-owned validators without changing their rejection order, and replace five single-export loader wrappers with direct action imports. The canonical JSON rejection and exit-finalization owners stay unchanged.
Removing the broad loader types exposed unclear export ownership in the existing agent-exec command. Split its existing input/config preparation and result projection into owners the command actually consumes, with behavior preserved and test imports migrated without weaker assertions. Remove redundant casts at the new input owner and document its one required typed-merge assertion; the old assertion baseline shrinks without adding an allowance. This makes export ownership explicit instead of hiding unused exports behind whole-module type references. The tooling envelope consumer and the existing pinned-config loader exemption move to the matching owners.
Production: net -1 line, discounting the pure moves. Tests: +9 lines. No flags, configuration, dependencies, workflow, config policy, or result semantics change.
User Impact
Help text and command behavior are unchanged. Help registration avoids loading action-only code; onboarding still discovers provider metadata needed to render its provider-specific options. This does not claim that the entire CLI startup is runtime-free.
Evidence
Existing cold-help regressions reproduced before the fix; 241 tests across seven suites passed after the owner split, then both canonical boundary guards and the 52 input/config tests passed again after assertion cleanup, including JSON rejections, recommendation validation, parent/leaf options, agent exit behavior, config isolation, and terminal-result projection.
Fresh-process, source-mode proof through the actual setup/onboard fast-help renderer and the agent Commander registrations: all five help outputs are unchanged apart from the expected commit revision in the setup/onboard banner. Agent help no longer loads runtime or exit finalization; setup/onboard no longer load option rejection during registration.
Fresh autoreview and independent owner/caller/dependency review found no actionable issues. The moved input/config and projection blocks were independently compared against the original source, with no behavior changes or weaker test assertions.
Full thirteen-path canonical changed gate passed, including core/test/scripts typechecks, lint, all export scans, runtime cycles, and boundary guards.
Canonical
pnpm buildpassed, including CLI bootstrap and SDK-export checks. Fresh source and built-launcher smoke coveredsetup,onboard,agent,agent exec, andagentshelp: all ten commands exited zero with empty stderr. Build metadata identifies4417a65d98e24cc493cca375defda3c0db319e5d.The temporary smoke comparator initially rejected the expected banner revision change. Raw output was preserved and verified; the remaining commands completed without repeating setup, the gate, or the build.
Exact reviewed head:
4417a65d98e24cc493cca375defda3c0db319e5d. Provenance: reproduced at source base6549b0a7c534750d9d6cbef305233b162704b291; stable-release regression range not established. Required hosted CI run 33308980556 passed on this exact head, includingopenclaw/ci-gate.