Skip to content

fix(cli): preserve option values and machine output - #116389

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-cli-20260730
Jul 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-cli-20260730

Conversation

@steipete

@steipete steipete commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes five CLI contract failures: required option values named --help or --json were mistaken for flags, parse errors suggested help paths built from option values, setup --baseline --json emitted no JSON, and explicit false-valued onboarding controls silently entered a wizard that ignored them.

Why This Change Was Made

Commander-owned parse facts now distinguish real options from consumed values, errors use the active command node instead of reparsing raw argv, baseline setup emits one structured result, and onboarding dispatch preserves explicit false provenance without treating omitted defaults as user intent. This is an AI-assisted maintainer QA fix.

User Impact

Automation can pass dash-leading values safely, machine-output modes remain trustworthy, parse errors point to real commands, baseline setup is scriptable, and documented negated/text-only onboarding flags reach the path that honors them.

Evidence

  • Real process reproduction before the fix created a literal --help workspace while startup bootstrap was skipped; --json as a required value redirected human output to stderr.
  • Blacksmith Testbox tbx_01kys7hva9qdktr7mchpekc70g: 381 focused tests across 10 CLI/setup/onboard files passed — https://github.com/openclaw/openclaw/actions/runs/30533059373
  • Review-triggered regressions: 184 and 52 affected tests passed after fixing repeated-option, empty-argv, configured-output, and post-command ownership cases.
  • Remote check:changed: core/coreTests typecheck, format, lint, deadcode, cycles, and storage/security guards passed.
  • Commander 15 source and typings were inspected directly for required-value consumption, option sources, custom command factories, and error ownership.
  • Conflict-free rebase to 7a9d2c3e; stable patch ID unchanged; final Codex autoreview found no accepted/actionable findings, confidence 0.87.

Source-blind CLI behavior proof

Validated exact head cd3b5eeb85bf9fa7d71611b9a2582b269983076d on Blacksmith Testbox tbx_01kysed0tp5zye9e1e77wryetk. The validator did not inspect source, diffs, tests, history, or credentials. Each probe used distinct temporary HOME/state/workspace paths, split stdout/stderr capture, a scrubbed environment, bounded timeouts, and cleanup; the Testbox was stopped afterward.

  • openclaw setup --help: exit 0; setup usage/help on stdout; stderr empty.
  • openclaw secrets apply --from --help: exit 1; stdout empty; stderr reports plan file --help missing, proving the token was consumed as the required value rather than activating help.
  • openclaw secrets apply --from --json: exit 1; stdout empty; human stderr reports plan file --json missing, proving JSON mode was not activated.
  • openclaw status --timeout 5000 --wat: exit 1; stderr suggests exactly openclaw status --help; no synthetic status 5000 path.
  • openclaw setup --baseline --json: exit 0; stderr empty; stdout is exactly one parseable object containing ok, config path/status, workspace path, and sessions path.
  • Real-PTY routing: onboard --no-tailscale-reset-on-exit and setup --custom-text-input both displayed the classic OpenClaw setup wizard. Flagless onboard displayed guided setup (“Hi — I’m OpenClaw… Setup choices”). PTY exits were intentional timeout 124 while awaiting user input.

@steipete
steipete marked this pull request as ready for review July 30, 2026 11:43
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations labels Jul 30, 2026
@steipete steipete self-assigned this Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Jul 30, 2026
@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 8:16 AM ET / 12:16 UTC.

ClawSweeper review

What this changes

The PR changes OpenClaw’s Commander-based CLI so required dash-leading values are not mistaken for flags, parse-error hints use the active command path, baseline setup emits JSON, and explicit false onboarding choices retain user intent.

Merge readiness

⚠️ Needs maintainer review before merge - 2 items remain

Keep this PR open for normal protected maintainer review. The revised PR body now provides concrete after-fix CLI behavior proof, and the supplied patch consistently moves decisions from raw argv heuristics toward Commander’s parsed command state; no discrete regression introduced by the patch was established from the available evidence.

Priority: P1
Reviewed head: cd3b5eeb85bf9fa7d71611b9a2582b269983076d

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has strong targeted proof and coherent regression coverage, while its shared CLI compatibility boundary still merits direct current-main owner review.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.
Evidence reviewed 5 items PR scope and command-fact boundary: The patch adds Commander-derived active-command and required-option-value facts, then consumes them in help, startup, and JSON-mode decisions instead of treating every raw --help/--json token as a flag.
Error guidance uses parsed ownership: The help formatter receives the failing Commander command path, avoiding hints that are reconstructed from option values embedded in argv.
Machine-output path is covered: Baseline setup now receives the JSON choice and setup emits one structured result; accompanying process and unit tests assert parseable stdout with empty stderr.
Findings None None.
Security None None.

How this fits together

OpenClaw’s CLI parses shell arguments into Commander command trees, then applies startup, help, output-mode, setup, and onboarding behavior. This change sits at the parsing boundary and affects both interactive operators and scripts consuming machine-readable output.

flowchart LR
  A[Shell arguments] --> B[Commander command tree]
  B --> C[Parsed command facts]
  C --> D[Help and error guidance]
  C --> E[JSON output routing]
  C --> F[Setup and onboarding dispatch]
  D --> G[Human CLI output]
  E --> H[Machine-readable output]
  F --> I[Requested setup flow]
Loading

Before merge

  • Resolve merge risk (P1) - This compatibility-sensitive change affects shared argv interpretation, help fast paths, JSON routing, and onboarding dispatch; a CLI owner should complete normal current-main and upgrade-path review before landing.
  • Complete next step (P2) - The revised PR has adequate real-behavior proof, but its protected compatibility-sensitive CLI boundary requires normal maintainer acceptance rather than an automated repair lane.
Agent review details

Security

None.

PR surface

Source +209, Tests +211. Total +420 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 14 257 48 +209
Tests 11 213 2 +211
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 470 50 +420

Review metrics

Metric Value Why it matters
CLI contract repairs 4 user-visible command behaviors changed The patch changes shared help/value parsing, diagnostic targeting, JSON output, and onboarding routing, so compatibility review should consider the combined command boundary rather than one isolated function.

Stored data model

Persistent data-model change detected: serialized state: src/cli/help-exit.process.test.ts, serialized state: src/commands/setup.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete CLI compatibility review (recommended)
    Have a CLI-area owner confirm the current-main command factories and upgrade-facing argument semantics before merging this shared parsing change.
  2. Accept the bounded residual risk
    A maintainer may merge based on the supplied focused tests and source-blind Testbox proof if they accept residual risk for uncommon legacy argument ordering.

Technical review

Best possible solution:

Retain the Commander-owned parsing boundary, preserve the supplied regression coverage and real-process proof, and land only after a CLI owner confirms that existing uncommon option orderings keep their Commander-defined semantics.

Do we have a high-confidence way to reproduce the issue?

Yes, at medium confidence: the PR supplies specific command invocations, focused process tests, and a reported source-blind after-fix Testbox transcript, but this review could not independently execute the current-main reproduction path.

Is this the best way to solve the issue?

Mostly yes: deriving ownership from Commander’s parsed command state is narrower and less error-prone than reparsing raw argv, but normal owner review should still confirm behavior across current command factories and existing invocation patterns.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 3e7ecb3aeaaf.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The reported failures can silently misroute real CLI automation, machine output, and explicit setup controls.
  • merge-risk: 🚨 compatibility: The PR changes how existing invocations interpret option-like values, help, JSON mode, and false-valued onboarding controls.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated PR body supplies a source-blind Testbox transcript for the reviewed head with explicit after-fix stdout, stderr, exit-status, JSON, and PTY-routing observations.

Evidence

What I checked:

  • PR scope and command-fact boundary: The patch adds Commander-derived active-command and required-option-value facts, then consumes them in help, startup, and JSON-mode decisions instead of treating every raw --help/--json token as a flag. (src/cli/program/commander-parse-facts.ts:1, cd3b5eeb85bf)
  • Error guidance uses parsed ownership: The help formatter receives the failing Commander command path, avoiding hints that are reconstructed from option values embedded in argv. (src/cli/program/help.ts:119, cd3b5eeb85bf)
  • Machine-output path is covered: Baseline setup now receives the JSON choice and setup emits one structured result; accompanying process and unit tests assert parseable stdout with empty stderr. (src/commands/setup.ts:134, cd3b5eeb85bf)
  • After-fix real behavior proof: The PR body records a source-blind Testbox run at the reviewed head covering dash-leading required values, parse-error help routing, baseline JSON output, and interactive false-valued onboarding controls; the linked GitHub Actions run is reported successful. (cd3b5eeb85bf)
  • Current-main and history limitation: A read-only local inspection command failed before execution with the environment’s bwrap network-namespace error, so this review could not independently establish current-main provenance or perform the required feature-history trace from the checkout.

Likely related people:

  • steipete: The reviewed head contains the sole proposed commit for the CLI parsing, setup-output, and onboarding-dispatch changes; no independent current-main history trace was available in this environment. (role: current CLI change author and recent area contributor; confidence: medium; commits: cd3b5eeb85bf; files: src/cli/program/commander-parse-facts.ts, src/cli/program/preaction.ts, src/commands/setup.ts)

Rank-up moves

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

  • Complete a CLI-owner review of current command factories and uncommon existing argument-ordering behavior.

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 (1 earlier review cycle)
  • reviewed 2026-07-30T11:47:01.564Z sha cd3b5ee :: needs real behavior proof before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 30, 2026
@steipete
steipete merged commit 1cbe674 into main Jul 30, 2026
200 of 218 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/autoqa-cli-20260730 branch July 30, 2026 12:22
vincentkoc added a commit that referenced this pull request Jul 30, 2026
* origin/main: (99 commits)
  docs(automation): rename scheduled-tasks feature wording to Automations (#114855)
  feat(ui): finish cron -> Automations rename in visible strings (#114853)
  feat(cli): add openclaw automations alias and reword cron display prose (#114854)
  feat(agents): rename scheduler agent tool cron -> automations (#114841)
  fix(tui): preserve session state across switches and reconnects (#116399)
  feat(agents): report CLI command outcomes in channel progress
  fix(cli): preserve explicit option intent (#116389)
  fix(release): trust update restart harness (#116301)
  test(reef): remove false-green live guard smoke (#116393)
  test(comfy): evaluate live guards after setup (#116388)
  fix(heartbeat): serialize wake lifecycle state (#116351)
  test: remove redundant extension boundary wrapper (#116385)
  fix(test): bound Testbox agentic and extension suites (#115696)
  fix(ui): show the correct Threads page size (#116349)
  test(discord): align progress timing expectations (#116377)
  feat(ui): add composable skill references (#116330)
  fix(qa): prevent Slack cleanup from stalling profile runs (#116361)
  fix(ci): validate frozen release candidates faithfully (#116357)
  improve(ci): fail_fast option for release validation, off by default (#116352)
  fix(agents): compare shell tool names case-insensitively and stop re-parsing tool labels
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 31, 2026
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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