Repository navigation
fix(cli): make commands, completion, and JSON output reliable - #116033
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 6:51 PM ET / 22:51 UTC. ClawSweeper reviewWhat this changesThis PR repairs CLI help, shell completion, option validation, JSON failure output, target selection, and shared Gateway password authentication across core command groups plus browser and LanceDB-memory plugin commands. Merge readinessKeep this PR open for explicit CLI-owner review. Current main still omits the password when shared CLI RPC calls reach the Gateway, while the PR’s focused change forwards the existing Gateway client credential field; the supplied real-process proof and passing proof check address the prior evidence gate. The Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s CLI parses operator commands, lazily loads command owners, then either changes local configuration or sends an RPC request to the Gateway. This PR tightens command validation and response formatting before those operations, including the shared credentials passed to remote Gateway calls. flowchart LR
Operator[Operator command] --> Parser[CLI parser and command registry]
Parser --> Validation[Help, completion, and option validation]
Validation --> Commands[Core and plugin command owners]
Commands --> Rpc[Shared Gateway RPC client]
Rpc --> Gateway[Gateway service]
Commands --> Output[Human-readable or JSON result]
Decision needed
Why: The repaired path is source-supported and proof-backed, but this PR combines many public CLI behaviors and is behind a main branch that has continued to change the CLI surface. Before merge
Agent review detailsSecurityNone. PR surfaceSource +393, Tests +1840. Total +2233 across 69 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase or otherwise refresh the PR onto current main, retain the shared password-forwarding repair only if its existing token/configured-auth paths remain intact, and land the validated owner-boundary fixes as one coherent CLI reliability change. Do we have a high-confidence way to reproduce the issue? Yes, for the shared Gateway path: current main’s CLI RPC runtime passes Is this the best way to solve the issue? Yes for the central authentication defect: extending the existing shared CLI-to-Gateway RPC options is narrower and more maintainable than adding per-command password handling. The whole sweep still needs current-base owner review because it combines many independent CLI repairs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 87d412d557ef. LabelsLabel justifications:
EvidenceWhat 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
History |
c151aa7 to
29be144
Compare
|
Merged via squash.
|
…aw#116033) * fix(cli): make commands, completion, and JSON output reliable * fix(cli): reconcile completion coverage with current main * test(cli): keep test routing stable across isolation lanes
What Problem This Solves
Fixes an issue where OpenClaw operators encounter inconsistent command help, unsafe or malformed shell completions, silently misparsed configuration paths, misleading gateway and service failures, incorrectly scoped session operations, ambiguous hook and pairing targets, and invalid machine-readable output across the CLI. Plugin-owned browser and memory commands also accepted invalid or conflicting inputs after beginning avoidable work.
Why This Change Was Made
Repair each failure at its existing CLI or plugin-owner boundary. Reuse Commander and the canonical parent-help, JSON-output, shell-quoting, option-validation, plugin-manifest, and gateway-authentication contracts. Preserve lazy command loading, documented configuration shapes and defaults, package and plugin boundaries, and dependency security policy.
User Impact
Evidence
Validated commit
bba69f928f66b108beb039920ce6a42ede3a2d9fon Linux Blacksmith Testbox leasestbx_01kyx337ej9bbn1rp470xyn0yxandtbx_01kyx65k65mv3sptmsyjzspjsh, including Actions run 30668530585 and Actions run 30671377091, using the repository's pinned dependencies andPNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false.Shared gateway password-authentication proof
Started with fresh temporary config, SQLite state, and workspace; performed real noninteractive onboarding with a generated password; started the built production gateway on an ephemeral loopback listener; and exercised the actual shared-client consumer, not a gateway command that already owned a separate password option:
Machine-readable verdict from that real gateway process:
{"command":"cron status","rpc":"cron.status","authMode":"password","listener":"loopback","wrongPassword":"denied","explicitPassword":"accepted","enabled":true,"jobs":2}gateway-password-secret-leak-check=cleanconfirms that the generated password appeared in none of the onboarding stdout/stderr, gateway log, failed-client output, or successful-client JSON/output. All gateway processes and temporary operator state were removed after the proof.The shared gateway-authentication option stays in this compatibility sweep because it repairs the existing shared CLI-to-gateway RPC owner boundary (
src/cli/gateway-rpc.ts,src/cli/gateway-rpc.runtime.ts) and its existing consumer (src/cli/cron-cli/register.cron-add.ts); it introduces no provider, config, or auth subsystem. This protected maintainer/CLI-owner scope decision is to land it together with its focused and real-process proof.ClawSweeper rank-up disposition: the branch was already refreshed onto fetched
mainbefore this repair. A second moving-base rebase is intentionally skipped because GitHub reports the PR mergeable, repository landing policy treats behind-main drift as advisory, and another rebase would invalidate the freshly verified head and active hosted CI without resolving a conflict. The requested shared Gateway RPC regressions were rerun on exact final headbba69f928f66b108beb039920ce6a42ede3a2d9f: all 182 tests passed on one-shot Blacksmith Testboxtbx_01kyx74k8803dt0r8b7q3mx8wa, Actions run 30672189115.Regression and stress evidence
pnpm test src/cli src/commands extensions/browser/src/cli extensions/memory-lancedb/memory-cli.test.ts: all seven Vitest shards passed, covering approximately 8,600 regression cases.node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/cli-json-stdout.e2e.test.ts test/cli-state-sqlite.e2e.test.ts: 24 real-process E2E tests passed.pnpm test:cli-response:contract: builtdistand exercised real launcher responses across onboarding, setup, configure, channels, doctor, models, plugins, gateway, agents, sessions, tasks, message, pairing, auth, config, secrets, skills, nodes, directory, sandbox, devices, MCP, browser, and webhooks; passed.pnpm test:startup:bench --preset all --runs 1 --warmup 0 --timeout-ms 30000: all command presets passed; complete stress run took 30.2 seconds.pnpm check:changed: passed all formatting, core/plugin/script lint, five typecheck lanes, environment/dependency/plugin-boundary/dead-export checks, SQLite/schema guards, and remaining repository gates; the final run took 7 minutes 41 seconds.node scripts/check-env-var-count.mjs --base origin/main:OPENCLAW_* count 517/517.No unrelated issue is closed or claimed fixed by this sweep. No changelog, dependency, lockfile, configuration schema, plugin SDK, environment-budget, or operator gateway/state change is included.