fix(backup): retry fs.rm on EBUSY to preserve tar retry backoff#101418
fix(backup): retry fs.rm on EBUSY to preserve tar retry backoff#101418lsr911 wants to merge 1 commit into
Conversation
On Windows, a failed runTar may leak an open file descriptor, causing fs.rm to throw EBUSY. The error was caught and logged but the file remained locked, so the next tar write attempt failed immediately — defeating the BACKUP_TAR_BACKOFF_MS retry mechanism. When EBUSY is detected, wait 500ms and retry fs.rm once so the next write attempt has a clean temp file. Closes openclaw#101382 Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 2:44 AM ET / 06:44 UTC. Summary PR surface: Source +18, Tests +84. Total +102 across 2 files. Reproducibility: yes. for a source-level reproduction: current main reuses one temp archive path, catches cleanup failure, and then retries tar against that path. I did not run a live Windows file-lock race. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a narrow backup retry fix that either avoids reusing a locked partial archive or preserves the cleanup failure path, with colocated regression coverage and real Windows or locked-file proof. Do we have a high-confidence way to reproduce the issue? Yes for a source-level reproduction: current main reuses one temp archive path, catches cleanup failure, and then retries tar against that path. I did not run a live Windows file-lock race. Is this the best way to solve the issue? No as submitted. Retrying cleanup is the right narrow area, but the PR should preserve/log a failed retry or avoid reusing the locked path, and replace the standalone proof script with real regression coverage. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5537bc9c4dc9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +18, Tests +84. Total +102 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Closing as a duplicate of #101397. Both PRs change the same Thank you for identifying the Windows lock race. A distinct reproduction outside this temp-archive cleanup site would be new evidence to reopen or split follow-up work. |
What Problem This Solves
On Windows,
writeTarArchiveWithRetryinsrc/infra/backup-create.tscleans up the temp archive withfs.rmbetween retries. If the failedrunTarleaked an open file descriptor (common on Windows),fs.rmthrowsEBUSY. The error was caught and logged, but the file remained locked — so the nextrunTarattempt failed immediately on the still-present file, completely defeating theBACKUP_TAR_BACKOFF_MSretry mechanism.Why This Change Was Made
When
EBUSYis detected during cleanup, wait 500ms and retryfs.rmonce before proceeding. This gives Windows time to release the leaked file descriptor, so the next write attempt starts with a clean temp file and the backoff retry loop can work as designed.Evidence
Real behavior proof (4/4 PASS)
Production change (6 lines)
Issue
Fixes #101382
🤖 Generated with Claude Code