Repository navigation
fix(backup): truncated archive verification hangs before restore - #188948
Conversation
Cancel every active entry without re-emitting an unhandled error, and stop spool iteration when cancellation arrives during a file write. Preserve the parser failure while joining consumers and closing all spool handles. Co-authored-by: steipete <[email protected]>
|
🦞👀 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 changesThis PR settles active archive consumers after parsing fails and verifies that temporary file handles close. Example: Verify a PostgreSQL backup whose gzip stream has its final 16 bytes removed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep open: this PR narrowly repairs a current-main archive-verification hang, preserves existing validation, and introduces no identified defects. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherBackup verify, create with verification, and restore share the archive verifier, which streams tar entries into private scratch before validating database artifacts. flowchart TD
A[Backup commands] --> B[Archive verifier]
B --> C[Tar inventory reader]
C --> D[Manifest consumer]
C --> E[Database spool]
D --> F[Validation or parse failure]
E --> F
F --> G[Consumer settlement and scratch cleanup]
Technical reviewBest possible solution: Keep cancellation and handle settlement in the existing archive reader and spool, preserving the original parse failure and all validation checks. Do we have a high-confidence way to reproduce the issue? Current-main cancellation and the pinned Minipass iterator contract establish the failure path; the author reports a matching before-and-after reproduction, which this read-only review did not execute. Is this the best way to solve the issue? This is the smallest complete repair: cancel every active consumer, avoid another iterator read after destruction, and retain the existing finally-based handle cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5ca51dcffd9c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +8. Total +13 across 2 files. Added test files: 0. View PR surface stats
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 Reviewed October 30, 2026, 10:10 PM ET / October 31, 2026, 02:10 UTC. |
|
Merged via squash auto-merge.
|
…188948) ## What Problem This Solves Fixes backup verification hanging before restore when a PostgreSQL archive has a truncated gzip stream. ## User Impact Damaged archives now fail promptly and close their temporary file handles. Archive verification keeps its existing single-pass behavior and corruption checks. ## Why This Change Was Made The streamed verification introduced in openclaw#188518 could throw while canceling an entry without an error listener, leaving another consumer waiting with an open file handle. Cancel every active consumer without re-emitting the error, then stop reading if cancellation occurs during a file write. The existing corruption test also checks that all opened handles close. ## Evidence - Reproduced the original truncated-archive case timing out at 120 seconds before the fix. It now rejects in 81 ms on pinned Bun and 69 ms on Node 24.22.1. - Pinned Bun: 101 tests passed across seven focused backup and startup-recovery files; one existing Windows-only long-path test skipped. Node 24.22.1: all 31 completeness tests passed. - Scoped TypeScript, lint, format, test-line and line-cap ratchets, and diff checks passed. No timeout, retry, skip, assertion weakening or baseline increase. - Fresh independent canonical autoreview of the accepted two-file patch: P0–P2, complete, no actionable findings. pr-simplify completed. Published source is verified against that accepted patch. - Linux proof covers archive verification and staging restore; the existing Windows-only case was not exercised. Exact-head PR CI supplies broader proof. Requested by @steipete ## Work sessions [Discussion, implementation and verification](https://team.openclaw.ai/chat/roboclaw/~key/dashboard/b5679712-7777-4ff7-a05a-81c1efab2069) Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes backup verification hanging before restore when a PostgreSQL archive has a truncated gzip stream.
User Impact
Damaged archives now fail promptly and close their temporary file handles. Archive verification keeps its existing single-pass behavior and corruption checks.
Why This Change Was Made
The streamed verification introduced in #188518 could throw while canceling an entry without an error listener, leaving another consumer waiting with an open file handle. Cancel every active consumer without re-emitting the error, then stop reading if cancellation occurs during a file write. The existing corruption test also checks that all opened handles close.
Evidence
Requested by @steipete
Work sessions
Discussion, implementation and verification