Repository navigation
fix(cli): keep backup create --to guard remedy in --json error output - #199763
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: needs maintainer review before merge. What this changesThe PR preserves the missing --to remedy on stderr when backup create rejects destination-specific flags in JSON mode. Example: Run openclaw backup create --namespace x --json without --to.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current CLI diagnostic bug with a focused change and sufficient real CLI proof; no actionable defects were found, and required CI is still running. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe backup command validates parsed CLI options before archive preparation; the shared CLI error owner then renders human diagnostics and the JSON failure envelope. flowchart TD
A[Backup CLI options] --> B[Backup create preflight]
B --> C[Expected CLI error]
C --> D[Shared failure renderer]
D --> E[Remedy on stderr]
D --> F[JSON envelope on stdout]
Technical reviewBest possible solution: Merge the existing focused conversion to the canonical expected-error owner once required CI passes. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the plain-error path, and the supplied base/head CLI receipt reproduces the generic stderr and verifies the correction; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes classification at the existing validation owner, preserving the shared renderer, accepted inputs, message, and output envelope without adding machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e182b8d58187. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests -1. Total +2 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 15, 2026, 4:55 PM ET / 21:55 UTC (Revision 2). |
|
Proof for unchanged contributor head Real CLI comparisonHost macOS arm64, source tier through No Controls passed for all three inputs:
Profile names are deliberately different; only those names and ocx's own preparation diagnostics are normalized/separated. No product output is suppressed. Checks and scope
Production +4/-1; tests +6/-7 (net -1), no allocation file, no new message text. The sole original human SunnyShu commit remains intact. Small logs and source/control harnesses are retained under the task's |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Final unchanged contributor head:
Task runtime state was removed; ocx scratch, worktree and temporary refs are being removed. The local branch and small proof receipts/harnesses remain available. |
|
Landed in 5b080d2. Thanks @SunnyShu0925. |
…openclaw#199763) fix(cli): report backup create remote-flag errors through the expected-error path `openclaw backup create --json` with `--namespace`, `--claim-namespace` or a `--keep-*` retention flag and no `--to` threw a plain error, so `--json` stderr showed the generic failure plus the Doctor hint instead of the existing "--namespace, --claim-namespace, and retention flags require --to <location>." message. The check runs before any archive work and now uses the expected-error path with the same message. No new text. Evidence: host, isolated state, no Gateway. Source CLI with --json and in text mode: `backup create --namespace x`, `backup create --keep-daily 3` and `backup create --claim-namespace`. Base prints the generic failure and Doctor hint, this change prints the existing message; JSON stdout, text output and exit 1 are identical, and no archive is written on either side. Vitest-source: one case fails on base, 18 pass here; typecheck, lint, full build, tarball validation and packed smoke pass. Receipts: openclaw#199763 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw backup create --namespace xwithout--tocorrectly prints the remedy in text mode, but adding--jsonhides it from stderr: the stdout envelope carries the message, yet stderr only shows the generic[openclaw] The CLI command failed.andFor help, run openclaw doctor.lines. This change routes the guard through the canonical expected-error owner so the remedy reaches stderr in both channels.Why This Change Was Made
Reuse the established expected-error path for the existing missing-target guard. Its predicate and message remain unchanged:
The guard still runs before archive-path preparation, lifecycle custody, archive creation or any offsite work. There is no new formatter, flag, default, retention policy or message text. The additional internal pre-migration caller was inspected: it passes only output/verify options, so it cannot enter this guard.
Evidence
Fresh host source CLI comparison uses isolated HOME/config/state/TMPDIR and no Gateway. It exercises
backup create --namespace x,backup create --keep-daily 3, andbackup create --claim-namespace, each with and without--json, on base and candidate. No--to,--outputor--dry-runwas added to these operator commands.Production +4/-1; tests +6/-7 (net -1), no allocation file. The contributor's original human commit and implementation are retained without additional source/test edits.
Two-way door: a revert restores generic JSON stderr without changing stored state. Blast radius: missing-
--topreflight reporting for backup create; archive contents, successful backups, retention, migration and upload behavior are unchanged. The separate sibling guards in register.backup.ts are not part of this change.Proof receipts: #199763 (comment)