Repository navigation
fix(cli): preserve command dispatch and structured errors - #139067
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 5, 2026, 12:49 PM ET / 16:49 UTC. ClawSweeper reviewWhat this changesUnifies CLI argument discovery and output detection so parent options and option terminators preserve command dispatch and machine-readable errors. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful fix for a defect still present on current main. No introduced correctness defect was found, and the latest test-only commit preserves the supplied production proof. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s CLI examines arguments before loading commands to select startup behavior and output handling. Commander then parses the registered command tree and dispatches actions or reports errors. flowchart TD
A[CLI arguments] --> B[Shared argument discovery]
B --> C[Startup and proxy policy]
B --> D[Command registration]
D --> E[Commander parsing]
E --> F[Command action]
E --> G[Structured or human error]
C --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource -56, Tests +289, Docs +4. Total +237 across 22 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: Keep argument interpretation in the shared discovery and Commander option-role owners, preserving command-specific output and startup policies without adding configuration. Do we have a high-confidence way to reproduce the issue? Yes, from current-main source: config -- get and skills -- verify lose output classification at the terminator. The contributor supplies failing-before and packaged after-fix observations; this review did not execute them. Is this the best way to solve the issue? Yes for the inspected OpenClaw boundary: reusing existing argument and option-role owners removes the disagreement more cleanly than adding separate output guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 426ca0d50f30. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Further source and real-distribution checks found two existing defects in the same command/token-role invariant. Holding this PR for their repair before landing.
Both were reproduced through the built CLI in isolated synthetic state with stdout, stderr, and exit status captured. The repair will keep root command discovery and registered option-role facts as their existing owners, with failing-before regression coverage and refreshed focused, build, review, and exact-head CI proof. The earlier 230 tests and 20 distribution checks remain valid for their tested cases; they did not cover these two paths. |
d4f35c3 to
4a7ad30
Compare
|
Updated this PR to Final local proof is green: complete changed-file checks, P2 review, independent source challenge, official build (3m14s), and 54 isolated invocations through The automatic fresh ClawSweeper review of this exact head is already in progress. The rewritten PR body includes the root cause, preserved parser/proxy contracts, failing-before cases and final packaged-CLI proof; no duplicate review request is needed. |
|
Final head I read the latest completed ClawSweeper review, now covering this exact head at 16:49 UTC. It accepts the real CLI proof and reports no correctness or security finding. Its sole Before merge item is unavailable Commander source in that reviewer environment. This is resolved: I personally inspected the installed Commander 15.0.0 dispatch, terminator and required-value implementation, alongside the independent peers and separate reviewer. The actual dependency paths are The canonical parser and registered option-role owners preserve command-specific output/startup policy while removing 56 production lines. All 54 synthetic runs retained config bytes and left no listener. Main has no overlap with this PR's 22 files or its dependency pins since the tested main parent. Proceeding through native prepare/merge; the body records the original bugs, repaired help regression, obsolete CI test correction and proof boundaries. |
|
Merged via squash.
|
* commit '3e4becea5e2ce38ede69e8ecf5302805ecbfc09c': refactor: simplify outbound message execution context (openclaw#139107) fix(models): keep ordinary chat selections session-scoped (openclaw#139232) docs: slim root agent instructions and clarify testing scope (openclaw#139236) test(agents): give the sibling-drain completion wait a tolerance on slow runners (openclaw#139176) refactor(workboard): use canonical queries for card-tree writes (openclaw#139106) fix(canvas): recognize versioned macOS nodes (openclaw#138958) fix: load GitHub connections without a default agent (openclaw#139222) fix(memory): explain unsafe legacy host-event path recovery (openclaw#139195) refactor(talk): centralize typed voice session queries (openclaw#139103) fix(cli): preserve command dispatch and structured errors (openclaw#139067) refactor(agents): consolidate reply failure summaries (openclaw#139175) fix(auth): keep an unset default model unchanged during login (openclaw#139218) perf(media): reuse validated attachment read handles (openclaw#139168) refactor(channels): simplify account configuration updates (openclaw#139096) refactor(android): remove unused updater export root (openclaw#139198) fix(gateway): stop admitting post-ready producers during close (openclaw#139092) fix(gateway): expose agent hook completion outcomes (openclaw#139155) fix(config): return the saved configuration after plugin install commits (openclaw#139203) fix(android): reduce repeated retries to unreachable gateways (openclaw#138732)
…39067) * fix(cli): preserve parent command argument roles * test(cli): preserve resolved action path coverage
Closes #139053
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where config reads and skill verification lost their usual structured errors when a parent option or
--preceded the child command. For example,openclaw config -- getandopenclaw skills -- verifyreturned human-only missing-argument errors even though those commands normally own machine-readable output.The same disagreement about argument roles also sent
openclaw -- config get gateway.modeinto the TUI and treated a value spelled--cardinskills verify --version --cardor--tag --cardas a request for card output.Why This Change Was Made
Command discovery, startup selection, and output ownership now reuse the existing root/parent parser. Leading literal boundaries survive downstream parsing and lazy command dispatch, and the existing Commander token-role helper serves both models and skills output detection. This removes duplicate config, skills, root-index, Gateway-path, and models-output scanning paths.
Canonical command paths still pass through the catalog's longest-prefix policy lookup. Membership-only rows for seven existing model child roots preserve their default startup behavior, while nested skills commands retain their proxy bypass. Gateway foreground/respawn selection uses the same command-path owner; literal
--forceand--resetstay operands. Conservative execution routing still falls through to Commander when needed.User Impact
Parent option values remain values, commands still dispatch after
--, and structured errors remain available where they are already the command's default. Actual--cardretains human output, config set keeps parse-only--json, and literal--helpstays an operand after a terminator. No flags, configuration fields, defaults, dependencies, schemas, or persistence contracts are added. Current main's SkillWorkshop storage ownership changes are preserved.Evidence
Full build and official CLI proof are complete. CI and the separate full-head source review are green at the current head.
Committed candidate:
3d752f9da95c90ead28774745659af521a406826, based on current main31903060a5d4a98ccd367aa6f15e66339a3ddcba. The committed diff matches the final reviewed and checked tree.Before production edits, real Commander comparisons and the actual
OpenClawCommanderror boundary reproduced the failures. The original built CLI also confirmed the leading-terminator TUI dispatch and card-shaped option-value failures. New root/tail, help, Gateway, lazy reparse, and respawn tests were captured failing before their repairs.The current-main focused suite passed 529 tests across 12 files. After the typecheck caught two test-declaration issues, both corrected files passed their 69-case boundary suite without changing assertions or production behavior. Coverage includes root/parent/leaf terminators, literal help operands, required values spelled
--, real card flags versus option values, Gateway destructive-option fencing, conservative route fallback, channels-add consumers, and complete model/startup policy dimensions.Production: 105 added / 161 removed, net -56 lines. Tests: 297 added / 8 removed, net +289. Documentation: +4. No test-only production hooks were introduced.
Commander 15.0.0 was personally inspected in this checkout:
lib/command.jschild dispatch at line 1562, terminator handling at line 1789, and required-value consumption at line 1808. The launcher validates profile arguments before version handling:--profile --versionreturns a missing-value error, while--profile work --versionsucceeds. This preserves the existing validation owner.Pinned oxfmt 0.65.0 and whitespace checks pass. Final P2 review and the independent source challenge are clean; the final full changed gate passes, including core/test types, changed-file lint, dead-export scans, storage/loader/security guards, and runtime import-cycle checks. A second review also caught a help-classification regression when a command-owned value resembled a root option before
--help. Four real-Commander cases reproduced it before the early help policy was restored to its existing conservative owner. The corrected help/profile/container/entry/Gateway sweep passes 373 tests across nine files.The full
pnpm buildpassed in 3m 14s, including runtime bundles, declarations, plugin artifacts, Control UI budgets, and CLI bootstrap checks.dist/build-info.jsonrecords4a7ad309e387ebbc553965991aca71f15bc13a00. All 21 files in that built candidate are byte-for-byte identical at the current head; the successor only updates the existing startup-context test. Dependencies were installed into this checkout with the frozen lockfile; no shared install was reconciled.54/54 official dist CLI cases passed through
node openclaw.mjs, using temporary synthetic home/state/config. Stdout, stderr, and exit codes were captured and completely inspected. There was no source loader or output-suppression override. Machine-output commands produced only their raw value or JSON; requested help retained its ordinary help text.cli_errorplus normal diagnostic on stderr--version --card/--tag --card, with/without parent agent--cardkeeps human output--helpat root, parent, and leaf boundaries--force --reset, root/parent/leaf forms--log-levelbefore--helpAll 54 cases left their synthetic config unchanged and no Gateway listener behind; the fixture was removed. Config reads also used the unusable proxy CA to prove their existing bypass. These runtime captures are attributed to
4a7ad309e387ebbc553965991aca71f15bc13a00and remain applicable because all original candidate file blobs are unchanged. Exact-head CI passed for3d752f9da95c.CI run 33975607691 caught an obsolete test assertion that expected Gateway token values to be misidentified as commands. The committed test-only correction updates the existing case to use valid
acp --token clientinput and verifies that the authoritative ACP action path preserves protocol stdout. It no longer pins approximate parser output; negative-token and actual-client cases remain. The original 21 files and all production bytes are unchanged, preserving the completed build and 54-case runtime evidence. The corrected test was independently reviewed through P2; its 239-case focused suite and scoped changed-file gate pass. Fresh exact-head CI is green.The separate final 22-file source review is clean at
3d752f9da95c90ead28774745659af521a406826, with verified inheritance from the unchanged production candidate and fresh inspection of the test correction. CI preflight actually tested merge170a152fac87923c4b8a9ea68bedd268b0f32e8b, whose ordered parents are main707edba619a6244fb6a465f9c4b01a856994a29cand this exact PR head.The latest completed ClawSweeper review at exact
3d752f9d(16:49 UTC) accepts the 54-case runtime proof and has no patch/security finding. Its remaining environment limitation obtaining Commander 15.0.0 is addressed by actual pinned-source inspection by the owner, independent peers, and separate direct reviewer. No production behavior changed in the test-only successor, and no duplicate re-review request was posted.