fix(backup): isolate retry temp archives#101449
Merged
Merged
Conversation
Contributor
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
Member
|
Land-ready at exact head Maintainer work:
Proof:
Known proof gap: the full OpenClaw test suite was not run on native Windows; Windows proof targeted the filesystem lock contract, while the production retry behavior is covered by the focused tests and full hosted Linux CI. |
Member
|
Merged via squash.
|
This was referenced Jul 7, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 8, 2026
* fix(backup): isolate retry temp archives Closes openclaw#101382 * fix(backup): remove unused retry path initializer --------- Co-authored-by: Vincent Koc <[email protected]>
giodl73-repo
pushed a commit
to giodl73-repo/openclaw
that referenced
this pull request
Jul 8, 2026
* fix(backup): isolate retry temp archives Closes openclaw#101382 * fix(backup): remove unused retry path initializer --------- Co-authored-by: Vincent Koc <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.tmppath..retry-Nfiles do not remain.Change Type
Scope
Real behavior proof
Behavior addressed: Backup archive retries no longer reuse a temp archive path that failed cleanup with
EBUSY; each retry writes to a fresh.retry-Npath and returns the successful temp path.Environment tested: Linux workspace with Node running TypeScript sources via
node --import tsxon branchfix/101382-backup-temp-retry.Steps run after the patch: Called the actual
testApi.writeTarArchiveWithRetryproduction helper fromsrc/infra/backup-create.ts, forced the first two cleanup attempts to throwEBUSY, and let the third tar attempt succeed.Evidence after fix:
Output:
{ "attemptedPaths": [ "/tmp/openclaw-proof-backup.tar.gz.tmp", "/tmp/openclaw-proof-backup.tar.gz.tmp.retry-2", "/tmp/openclaw-proof-backup.tar.gz.tmp.retry-3" ], "completedPath": "/tmp/openclaw-proof-backup.tar.gz.tmp.retry-3", "cleanupCalls": [ "/tmp/openclaw-proof-backup.tar.gz.tmp", "/tmp/openclaw-proof-backup.tar.gz.tmp.retry-2", "/tmp/openclaw-proof-backup.tar.gz.tmp", "/tmp/openclaw-proof-backup.tar.gz.tmp.retry-2" ], "logLines": [ "Backup archiver could not remove temp archive /tmp/openclaw-proof-backup.tar.gz.tmp between retries: EBUSY. Continuing.", "Backup archiver hit a live-write race on /tmp/openclaw-state/sessions/live.jsonl (attempt 1/3); retrying in 10s.", "Backup archiver could not remove temp archive /tmp/openclaw-proof-backup.tar.gz.tmp.retry-2 between retries: EBUSY. Continuing.", "Backup archiver hit a live-write race on /tmp/openclaw-state/sessions/live.jsonl (attempt 2/3); retrying in 20s." ] }Observed result: The production retry helper attempted
.tmp, then.tmp.retry-2, then.tmp.retry-3, and returned the successful.tmp.retry-3path while logging the twoEBUSYcleanup failures.Not tested: Native Windows file-lock behavior was not run in this Linux environment; the proof exercises the same production retry and cleanup path with real
EBUSYerrors injected at thefs.rmboundary.Root Cause
EBUSY.createBackupArchivealways published the original temp path, so the retry helper could not safely switch to a fresh temp path.Regression Test Plan
src/infra/backup-create.test.tsforEBUSYcleanup followed by a successful retry on.retry-2.src/infra/backup-create.test.tsfor cleanup of retry temp paths when a later attempt fails.src/commands/backup.atomic.test.tsproving intermediate retry temp archives are removed after cleanup races across multiple retries.Verification
node scripts/run-vitest.mjs src/infra/backup-create.test.ts src/commands/backup.atomic.test.tspassed.git diff --checkpassed.pnpm check:test-typespassed.Impact Assessment
User-visible / Behavior Changes
Backups that hit a live-write EOF race and cannot remove the failed temp archive can still complete by writing the next attempt to a fresh retry temp path.
Security Impact
Closes #101382