Skip to content

fix(cli): make commands, completion, and JSON output reliable - #116033

Merged
steipete merged 3 commits into
mainfrom
codex/cli-command-reliability-sweep-20260729
Jul 31, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/cli-command-reliability-sweep-20260729

Conversation

@steipete

@steipete steipete commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Bash, Fish, Zsh, and PowerShell receive correct, safely escaped value completions and inherited options.
  • Configuration paths preserve quoted and escaped keys and fail before an invalid path can change settings.
  • Gateway, service, discovery, and password-authenticated remote commands report one correct, parseable outcome.
  • Sessions and cron reject unsupported or blank filters instead of acting on a wider target.
  • Message, plugin, and skill parent commands display successful help; invalid channels and contradictory poll flags fail before dispatch.
  • Devices, nodes, pairing, and hooks resolve and validate the intended target without modifying a different resource.
  • Doctor preserves known service status and reports broken installed-plugin package entries.
  • Model scans and aliases produce deterministic, safe output and actionable fallback diagnostics.
  • Browser and memory plugin commands reject invalid option choices and conflicting inputs before dispatch or embedding.

Evidence

Validated commit bba69f928f66b108beb039920ce6a42ede3a2d9f on Linux Blacksmith Testbox leases tbx_01kyx337ej9bbn1rp470xyn0yx and tbx_01kyx65k65mv3sptmsyjzspjsh, including Actions run 30668530585 and Actions run 30671377091, using the repository's pinned dependencies and PNPM_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:

openclaw onboard --non-interactive --gateway-auth password ...
openclaw gateway run --bind loopback --port <ephemeral>
openclaw cron status --url ws://127.0.0.1:<ephemeral> --password <wrong> --json
=> authentication rejected
openclaw cron status --url ws://127.0.0.1:<ephemeral> --password <generated> --json
=> authentication accepted; valid cron.status JSON

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=clean confirms 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 main before 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 head bba69f928f66b108beb039920ce6a42ede3a2d9f: all 182 tests passed on one-shot Blacksmith Testbox tbx_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: built dist and 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.
  • Focused completion/config suites: 274 passed; 58 expected skips because Fish is unavailable on the runner. Real Bash, Zsh, and native PowerShell completion cases executed successfully.
  • Focused cron command registration and validation: 135 passed.
  • Exact-head shared Gateway RPC, Gateway CLI, and cron RPC regression proof: 182 passed.
  • Hosted-only Vitest routing regression plus the tracked isolated completion suite: 269 passed; 19 expected Fish-binary skips. The planner now discovers the process owner by configuration instead of assuming a fixed shard index.
  • Commander v15 upstream source inspected directly for choices, grouped/attached short options, option-name normalization, and repeat parsing semantics.
  • node scripts/check-env-var-count.mjs --base origin/main: OPENCLAW_* count 517/517.
  • Whole-branch and final-diff autoreview plus TruffleHog secret scans: clean, no accepted/actionable findings.

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.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes commands Command implementations size: XL maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 18:28
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 6:51 PM ET / 22:51 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Ready for maintainer review - 4 items remain

Keep 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 maintainer label and broad, behind-base compatibility surface make this a human merge decision rather than an automated close or repair route.

Priority: P2
Reviewed head: 29be1445a5ec24aba42fd72a8f88091a3f11b758
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR presents strong real-process evidence and focused regression coverage; current-base compatibility review is the remaining material merge reducer.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body contains an after-fix, redacted real-process Gateway transcript and structured success verdict covering wrong-password rejection, explicit-password acceptance, JSON output, and secret-leak checking; the supplied check rollup also marks real behavior proof successful.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body contains an after-fix, redacted real-process Gateway transcript and structured success verdict covering wrong-password rejection, explicit-password acceptance, JSON output, and secret-leak checking; the supplied check rollup also marks real behavior proof successful.
Evidence reviewed 5 items Current-main shared RPC gap: The shared CLI runtime forwards url and token into callGateway, but does not forward a password even though the Gateway call contract accepts password; the PR’s focused change adds that missing argument.
Gateway contract supports the repair: The current Gateway call options explicitly include an optional password credential, so forwarding the parsed shared CLI option uses an existing authentication contract rather than adding a provider or Gateway protocol route.
Feature provenance: The current shared RPC runtime lines are attributed to the July 31, 2026 commit that introduced this current CLI facade; the PR repairs that active owner boundary rather than retaining an obsolete wrapper.
Findings None None.
Security None None.

How this fits together

OpenClaw’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]
Loading

Decision needed

Question Recommendation
Should the CLI owners accept this broad, maintainer-labelled reliability sweep after it is refreshed against current main, including the shared explicit Gateway password path? Refresh and land the coherent sweep: Rebase or refresh the exact head, confirm the shared Gateway password and existing token/configuration paths, then merge the validated fixes together.

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

  • Resolve merge risk (P1) - The branch is behind current main and changes shared parsing, completion, and Gateway credential behavior across many command groups; a current-head refresh must confirm that no recent CLI changes were overwritten or made redundant.
  • Resolve merge risk (P1) - Adding --password to the shared RPC option set is compatibility-sensitive because scripts and remote operators may rely on existing token, configured, or environment-based credential resolution.
  • Complete next step (P2) - The central bug is source-proven and proof-backed, but the protected maintainer label and broad, behind-base compatibility surface require explicit owner review rather than an automated repair or close.
Agent review details

Security

None.

PR surface

Source +393, Tests +1840. Total +2233 across 69 files.

View PR surface stats
Area Files Added Removed Net
Source 35 638 245 +393
Tests 34 2138 298 +1840
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 69 2776 543 +2233

Review metrics

Metric Value Why it matters
Shared authentication option 1 added CLI option The new shared --password option reaches multiple Gateway RPC command consumers, so its precedence and redaction behavior need upgrade-focused review.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-post-upgrade.test.ts, migration/backfill/repair: src/commands/doctor-post-upgrade.ts, serialized state: src/cli/completion-cli.test.ts, serialized state: src/commands/doctor-post-upgrade.test.ts, serialized state: src/commands/doctor-post-upgrade.ts, serialized state: src/commands/models/aliases.test.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh compatibility proof before merge (recommended)
    Update the branch against current main and rerun focused shared Gateway RPC coverage plus the existing real password-authenticated Gateway proof.
  2. Accept the reviewed compatibility scope
    A CLI owner may merge the current approach after confirming that explicit password forwarding is the intended public shared-RPC contract.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Refresh against current main, rerun focused gateway RPC authentication coverage, and retain redacted real-process proof for password-authenticated cron RPC.

Technical review

Best 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 url and token but not password, while the Gateway call contract accepts it. The PR body also provides a redacted real-process password-authenticated cron status --json before/after outcome.

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.

Labels

Label justifications:

  • P2: This is a broad operator-facing CLI reliability repair with normal priority rather than an evidenced outage, data-loss event, or security bypass.
  • merge-risk: 🚨 compatibility: The branch changes shared command parsing, completion generation, inherited options, and failure output that existing scripts and operator workflows can consume.
  • merge-risk: 🚨 auth-provider: The shared Gateway RPC facade gains explicit password parsing and forwarding for remote authenticated command consumers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains an after-fix, redacted real-process Gateway transcript and structured success verdict covering wrong-password rejection, explicit-password acceptance, JSON output, and secret-leak checking; the supplied check rollup also marks real behavior proof successful.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains an after-fix, redacted real-process Gateway transcript and structured success verdict covering wrong-password rejection, explicit-password acceptance, JSON output, and secret-leak checking; the supplied check rollup also marks real behavior proof successful.

Evidence

What I checked:

  • Current-main shared RPC gap: The shared CLI runtime forwards url and token into callGateway, but does not forward a password even though the Gateway call contract accepts password; the PR’s focused change adds that missing argument. (src/cli/gateway-rpc.runtime.ts:41, 87d412d557ef)
  • Gateway contract supports the repair: The current Gateway call options explicitly include an optional password credential, so forwarding the parsed shared CLI option uses an existing authentication contract rather than adding a provider or Gateway protocol route. (src/gateway/call.ts:76, 87d412d557ef)
  • Feature provenance: The current shared RPC runtime lines are attributed to the July 31, 2026 commit that introduced this current CLI facade; the PR repairs that active owner boundary rather than retaining an obsolete wrapper. (src/cli/gateway-rpc.runtime.ts:23, f4f990a91bce)
  • Real behavior proof: The PR body records a built production Gateway started with password authentication, a wrong-password denial, an explicit-password success through cron status --json, a redacted JSON verdict, and a secret-leak check; the supplied check rollup marks Real behavior proof successful. (29be1445a5ec)
  • Current-base review state: The PR head is not an ancestor of current main, and current main includes a later CLI completion fix, so the final merge review should refresh against the current base rather than infer a three-way result from the stale branch. (src/cli/completion-cli.ts:1, 87d412d557ef)

Likely related people:

  • Peter Steinberger: Current-main blame attributes the shared Gateway RPC runtime owner boundary to this author, and the supplied PR metadata identifies the same contributor as the author of the proposed repair sweep. (role: recent area contributor; confidence: high; commits: f4f990a91bce, 0bdb8cef8e09, 29be1445a5ec; files: src/cli/gateway-rpc.runtime.ts, src/cli/gateway-rpc.ts, src/cli/completion-cli.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and rerun the focused shared Gateway RPC proof on that exact head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-29T18:32:16.557Z sha 65c2a8f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-29T18:41:15.424Z sha c151aa7 :: needs real behavior proof before merge. :: none

@steipete steipete self-assigned this Jul 31, 2026
@steipete
steipete force-pushed the codex/cli-command-reliability-sweep-20260729 branch from c151aa7 to 29be144 Compare July 31, 2026 22:45
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 31, 2026
@steipete
steipete merged commit 433bb3f into main Jul 31, 2026
137 of 139 checks passed
@steipete
steipete deleted the codex/cli-command-reliability-sweep-20260729 branch July 31, 2026 23:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations extensions: memory-lancedb Extension: memory-lancedb maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant