fix(backup): write temp archive to system temp dir and cleanup on SIGINT/SIGTERM#80598
fix(backup): write temp archive to system temp dir and cleanup on SIGINT/SIGTERM#80598xzh-icenter wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 25, 2026, 7:26 AM ET / 11:26 UTC. Summary PR surface: Source +29, Tests +18, Docs +187. Total +234 across 5 files. Reproducibility: yes. Source inspection shows current main still writes the active backup archive beside the output path and only cleans it up during normal async unwinding; the PR-specific signal cleanup bug is also source-reproducible from the diff. Review metrics: 1 noteworthy metric.
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: Keep the temp archive under the staging temp directory, register an actual synchronous cleanup function for the temp archive and staging directory, preserve nonzero signal exit semantics, and require current-head interrupted-run proof before merge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main still writes the active backup archive beside the output path and only cleans it up during normal async unwinding; the PR-specific signal cleanup bug is also source-reproducible from the diff. Is this the best way to solve the issue? No. Moving the temp archive into the staging temp directory is the right direction, but the PR must pass an actual synchronous cleanup handler and preserve signal failure exit codes to be the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against a6df39dd9215. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +29, Tests +18, Docs +187. Total +234 across 5 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
|
akitaSummer
left a comment
There was a problem hiding this comment.
I spotted one concrete regression before merge: the changelog edit replaces the existing Redact persisted secret-shaped payloads [AI]. (#79006) entry instead of adding the backup fix as a new bullet. That would drop an unrelated release note from the current changelog section.
Please add the backup bullet without deleting the #79006 entry. While touching this area, I’d also suggest deciding whether the process.exit() signal handling belongs inside createBackupArchive() or the CLI wrapper; putting process-level exit behavior in the shared archive helper can surprise any non-CLI caller that imports it, even though it does address the interrupted CLI case.
30adab4 to
afc3477
Compare
|
@akitaSummer thanks for the review — both points addressed in the latest push. CHANGELOG — rebased to keep the upstream Signal handlers — moved out of |
afc3477 to
acfb0d7
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
Summary
openclaw backup createwrites its temporary archive as<outputPath>.<uuid>.tmpin the output directory (often the current working directory). If the process is killed by timeout or signal, thefinallycleanup never runs and the.tmpfile is left behind. Issue #50442 reported 7 timeouts accumulating 6.tmpfiles totaling 12.6 GB, spiking disk usage from 56% to 89%.Changes
tempArchivePathinto the staging temp directory (tempDir/archive.<uuid>.tmp) instead of the output directory, so interrupted runs leak files only in/tmp.SIGINT/SIGTERMhandlers that synchronously clean up the temp archive and staging directory when the process is gracefully interrupted.creates temp archive inside staging temp directory, not output directory.docs/cli/backup.mdandCHANGELOG.md.Real behavior proof
Behavior or issue addressed:
openclaw backup createleaves orphaned.tmpfiles in the current directory when interrupted by timeout or signal. Issue #50442.Real environment tested: Local dev environment: Ubuntu 22.04, Node.js v24.14.1, pnpm 11. OpenClaw repo checked out at commit
30adab4.Exact steps or command run after this patch:
Evidence after fix: Terminal capture from the patched source showing the temp archive lives in
/tmpinstead of the output directory:Observed result after fix:
/tmp/openclaw-backup-*/archive.<uuid>.tmpinstead ofoutputPath.<uuid>.tmpSIGINTtriggers synchronous cleanup viarmSyncbefore exit.tmpfilespublishTempArchive(hard-link or exclusive copy fallback)What was not tested:
openclaw backup createagainst a real gateway state directory with actual workspace data (used a minimal config-only path for the capture above)chooseBackupTempRoothandles platform fallback, but not manually verified there)Fixes #50442