Repository navigation
fix(cli): show backup namespace remedy in JSON errors - #199781
Conversation
Before/after proofBaseline: main All runtime commands ran on the host through ocx, with a temporary HOME/OPENCLAW_HOME and explicit source tier, main once and candidate once, for each command: For both commands, stdout is byte-identical on both sides: {
"ok": false,
"error": {
"type": "cli_error",
"message": "--namespace requires --from <location>."
}
}Controls on both sides:
vitest-source tier: the registration regression failed against unchanged main production code ( Candidate head: Local checks on the host through ocx:
Inspectable local receipts: |
|
@clawsweeper re-review |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR makes backup verify and restore print the existing missing --from remedy on stderr in JSON mode. Example: Run openclaw backup verify ./x.tar.gz --namespace n --json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR is a correct, focused diagnostic fix that current main still needs; no actionable findings remain, and exact-head CI is still running. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherBackup command registration validates local versus remote options before dispatch; the shared CLI failure renderer turns expected errors into human stderr and structured JSON stdout. flowchart TD
A[Backup CLI arguments] --> B[Verify and restore registration]
B --> C[Namespace without location guard]
B --> D[Local or remote backup command]
C --> E[Expected CLI error]
E --> F[Root failure renderer]
F --> G[Remedy stderr and JSON stdout]
Technical reviewBest possible solution: Use the existing expected-error helper at the shared namespace guard, as this PR does. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the generic-error path, and the author's isolated CLI captures demonstrate the failure for both affected commands; this review ran no target code. Is this the best way to solve the issue? The patch fixes error classification at its producer and reuses the canonical renderer without adding formatting logic, state, or another reporting path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b080d29ff84. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests -1. Total 0 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: No label 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, 5:31 PM ET / 22:31 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in f17c941. |
fix(cli): show backup namespace remedy in JSON errors `openclaw backup verify` and `restore` with `--namespace` and no `--from` threw "--namespace requires --from <location>." as a plain error, so with `--json` stderr showed the generic failure plus the Doctor hint instead of the existing message. The check runs before dispatch 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 verify ./x.tar.gz --namespace n` and the same for `restore`. Base prints the generic failure and Doctor hint, this change prints the existing message; text output, JSON stdout and exit codes are identical, and with both --from and --namespace both sides take the remote path the same way. Vitest-source: the pre-dispatch case fails on base and passes here; the git log partial-limit rejection and every dispatch case stay covered. Full build and packed smoke pass. Receipts: openclaw#199781 (comment). Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw backup verify <archive> --namespace n --jsonandbackup restorewithout--fromhide the existing remedy on stderr behind a generic failure and Doctor hint.User Impact
Both commands now print
--namespace requires --from <location>.on stderr in JSON mode, just as they already do in text mode. JSON stdout, exit codes and remote backup routing are unchanged.Why This Change Was Made
Route the existing guard through
throwExpectedCliError; the predicate, message and command dispatch stay unchanged.Evidence
091312a21c1aand verified the fix for both commands, each in JSON and text mode. Restore used its required--targetoption.--fromand--namespace, both versions reach the same remote-key validation instead of this guard.git log --limit 1oopsrejection-before-dispatch case is retained beside it in the same table; no test case was deleted. Shorter synthetic SQLite path fixtures preserve every dispatch assertion while keeping tests net -1. Production +2/-1.This is a two-way door: reverting restores the prior error classification. No state, config, policy or output wording changes. Blast radius is the shared verify/restore missing-
--fromguard.