Repository navigation
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 changesClassifies nine existing backup restore refusals as expected CLI errors so their remedies appear on stderr in JSON mode. Example: Run openclaw backup restore backup.tar.gz --target ./restored --postgres-connection-env "not a name" --json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a diagnostic defect still present on current main, with convincing CLI evidence and no actionable findings. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe backup CLI passes restore options to the archive restore command; guard failures flow through the shared CLI error renderer to JSON stdout and human-readable stderr. flowchart TD
A[Backup restore CLI] --> B[Restore command guards]
B --> C[Expected CLI error]
C --> D[Shared failure renderer]
D --> E[JSON stdout]
D --> F[Actionable stderr]
B --> G[Verified staging restore]
Technical reviewBest possible solution: Use the existing expected-error owner for these operator refusals while preserving restore safety checks and unexpected-error handling. Do we have a high-confidence way to reproduce the issue? Current-main guards throw plain Error, and the shared renderer suppresses their specific stderr diagnostics in JSON mode; supplied before/after CLI receipts confirm this path without requiring reviewer execution. Is this the best way to solve the issue? The patch is the smallest complete production fix: classify the existing refusals at their producer through the established error owner, preserving all predicates and messages. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9e85a1a71795. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests -1. Total 0 across 3 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. Review metrics
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, 8:56 PM ET / November 16, 2026, 01:56 UTC (Revision 2). |
|
Head: Validated restore-guard error forwarding against main baseline Real archive, repeated CLI proofTier: source, host through Each refusal below was run twice on main and twice on candidate, in both JSON and text modes:
Main JSON stderr contained only: Candidate JSON stderr contained the specific existing diagnostic, including the unchanged target path or variable name where applicable. All 28 refused CLI invocations per side exited 1. JSON stdout was byte-identical before/after; text-mode stdout/stderr were byte-identical. The existing file/non-empty contents stayed intact, and the other refused targets remained absent. A normal restore into an empty target succeeded on both sides with exit 0. The complete restore reports were identical ( Selected identical JSON stdout SHA-256:
Catch and privacy checks
The env guards interpolate only the variable name, never Tests and trim audit
Agent-directory containment and capacity are regression-test boundaries; no disk-space fault or artificial capacity restriction was injected into the CLI runs. Packaging and isolation
Representative commands (all with isolated task-owned HOME/state/config, and no Gateway): ocx test src/commands/backup-restore.test.ts src/commands/backup-verify-completeness.test.ts
ocx src -- --profile p199869proof backup create --only-config --output <archive>
ocx src -- --profile p199869proof backup restore <archive> --target <target> --postgres-connection-env 'not a name' --json
ocx src -- --profile p199869proof backup restore <archive> --target <target> --local-companion --json
ocx build --dtsExact-head gates and timings
Merge danger: reversible error-classification/test change. Blast radius: JSON stderr presentation of the existing restore guard refusals. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in a97d3d4. Thanks @SunnyShu0925. |
…penclaw#199869) fix(cli): report backup restore preflight errors through the expected-error path `openclaw backup restore <archive> --target ... --json` threw plain errors for its preflight checks (an invalid or unset `--postgres-connection-env` variable, a target inside the live state or agent directory, a target that is a file or a non-empty directory, not enough free disk space, `--local-companion` on an archive that is not a local-companion checkpoint, and `--postgres-connection-env` on an archive with no PostgreSQL stores), so `--json` stderr showed the generic failure plus the Doctor hint instead of the existing message. These checks now use the expected-error path with the same messages; messages name the variable but never its value. Restore behavior is unchanged. No new text. Evidence: host, isolated state, no Gateway. A small archive made with `backup create`, then `backup restore <archive> --target <tmp>` for seven refusals, twice per side, with --json and in text mode (28 calls per side). Base prints the generic failure and Doctor hint, this change prints the existing message; text output, JSON stdout, exit codes and targets are unchanged, and a normal restore into an empty target gives matching reports and file hashes on both. Vitest-source: eight cases fail on base, 66 pass here; full build and packed smoke pass. Receipts: openclaw#199869 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw backup restore backup.tar.gz --target ./restored --postgres-connection-env "not a name" --jsonexits 1, but stderr prints only[openclaw] The CLI command failed.andFor help, run openclaw doctor.— the actionable remedy (--postgres-connection-env requires an environment variable name.) survives only inside the stdout JSON envelope, so an operator watching stderr loses the next step. Eight more restore guards behave the same way: state/agent directory containment, file target, non-empty target, disk capacity, unset connection env,--local-companionprofile mismatch, and a plain archive without PostgreSQL stores. This PR routes those nine operator-input guards through the existingthrowExpectedCliErrorowner so--jsonfailures keep their remedy on stderr, with messages, exit codes, and the stdout envelope unchanged.backupRestoreCommandthrow plainError; the JSON failure path replaces their remedy text with the generic two-line banner on stderr.throwExpectedCliErrorowner, retaining their exact messages.Evidence
Repeated before/after CLI receipts and focused checks, baseline
a237e95ceb3f, candidate69e5e72fa8a7:Merge danger: reversible error-classification/test change. Blast radius: JSON stderr presentation of existing backup-restore refusals; no stored-data or public-contract change.