Repository navigation
fix(backup): give each SQLite header probe batch its own deadline - #187197
Conversation
One probe child with a fixed 10 s budget handled every state-dir path, so backups failed once the state dir held a few hundred thousand files. Probe in 4096-path batches and surface the failing cause (openclaw#187150).
|
🦞👀 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 splits SQLite header discovery into batches of at most 4,096 paths, each retaining the existing 10-second deadline. Example: Create a backup containing 2,502,506 candidate paths.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a demonstrated large-directory backup failure with a focused change to the existing probe owner; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherBackup preparation supplies retained filesystem paths to an isolated header-probe worker and consumes validated SQLite classifications before snapshot capture and archive publication. flowchart TD
A[Backup CLI] --> B[Retained path discovery]
B --> C[Header probe batch owner]
C --> D[Isolated runtime worker]
D --> E[Validated classifications]
E --> F[Snapshots and archive publication]
Technical reviewBest possible solution: Retain the bounded loop in the existing probe owner and land after the ordinary exact-head merge gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the unbounded workload under one fixed deadline, and the supplied built-CLI comparison demonstrates the failure repeatedly; this read-only review ran no target code. Is this the best way to solve the issue? The smallest complete fix is to bound each existing isolated worker invocation while preserving validated classifications and fail-closed publication, which the final diff does. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e07baefd0dcd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8, Tests -1. Total +7 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 October 29, 2026, 1:53 AM ET / 05:53 UTC (Revision 2). |
Linux built-CLI backup proof for
|
| Revision | State | Run | Paths probed | Child count | Largest batch | Probe timeout | backup create | backup verify | Verified entries |
|---|---|---|---|---|---|---|---|---|---|
| main | small | 1 | 19 | 1 | 19 | none | success | success | 19 |
| candidate | small | 1 | 19 | 1 | 19 | none | success | success | 19 |
| main | large | 1 | 2502506 | 1 | 2502506 | ETIMEDOUT at 10 s | failure; no archive published | not applicable | — |
| main | large | 2 | 2502506 | 1 | 2502506 | ETIMEDOUT at 10 s | failure; no archive published | not applicable | — |
| candidate | large | 1 | 2502506 | 611 | 4096 | none | success | success | 2502506 |
| candidate | large | 2 | 2502506 | 611 | 4096 | none | success | success | 2502506 |
The main failures are specifically the original single-child 10,000 ms ETIMEDOUT, each over the entire large path list. Both fail closed without publishing an archive. Candidate children each receive at most 4,096 paths and their own unchanged 10-second deadline. Both complete, and both archives pass standalone backup verification with SQLite inventory verification.
SQLite classification is unchanged: the passive observer records true for the real SQLite file on both small-state controls and both successful large candidate runs. Plain and missing files remain false in the regression test. No backup format, source-selection, snapshot or failure policy was changed.
Calibration and focused checks
The initial 1.5-million-file corpus timed out on the first main run but completed after cache warming (8.06 s header probe). That successful calibration run is retained, not counted as a failing reproduction. The final corpus was enlarged to 2.5 million real files for the repeated comparison above. No artificial slowdown was introduced.
- Candidate focused header-probe suite: 1 passed, 1 skipped. The unchanged unreadable-file archive test is guarded when running as root; this container ran as root.
- The consolidated test on main fails as expected:
expected 1 to be greater than 1at the child-count assertion, after its SQLite/plain/missing classifications and deduplicated map size pass. - Targeted oxfmt check passes. Targeted oxlint: zero warnings and zero errors.
- Simplification removes the extra probe helper, test-only exported batch-size constant and unrelated error-message expansion. The existing owner now batches its unchanged isolated-worker protocol directly and hoists worker-argument resolution out of the loop.
- Final production delta: +34/−26 (60 changed lines, net +8) versus the contributor's 75 changed production lines. Tests: +7/−8 (net −1) against merge base
44ffd0a845b32480ffaf46ff6cfbcaa2267491c1. The original contributor commit is preserved.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…enclaw#187197) fix(backup): give each SQLite header probe batch its own deadline backup create sent every path in the state directory to one SQLite header-probe child with a fixed 10 s timeout. Probe time grows with the file count, so a state directory with a few hundred thousand files (for example agent worktrees) timed out and the backup aborted with a generic error, even though every file was readable. Paths are now probed in bounded batches, each with its own deadline, and a probe failure names its underlying cause. SQLite classification and the backup format are unchanged. Evidence: built Linux CLI with a state directory of 2,502,506 real text files plus a real SQLite database. On main, one child probed every path, hit the 10 s ETIMEDOUT and published no archive (twice); with this change 611 children probed at most 4,096 paths each, and both archives passed a standalone backup verify of all 2,502,506 entries, including the SQLite inventory (twice). Small-state controls pass on both refs, and the SQLite file is detected in every run. Details: openclaw#187197 (comment). Thanks @wr-web. Co-authored-by: Ayaan Zaidi <[email protected]>
|
Thanks @wr-web - I hit this same constraint |
…87197) fix(backup): give each SQLite header probe batch its own deadline backup create sent every path in the state directory to one SQLite header-probe child with a fixed 10 s timeout. Probe time grows with the file count, so a state directory with a few hundred thousand files (for example agent worktrees) timed out and the backup aborted with a generic error, even though every file was readable. Paths are now probed in bounded batches, each with its own deadline, and a probe failure names its underlying cause. SQLite classification and the backup format are unchanged. Evidence: built Linux CLI with a state directory of 2,502,506 real text files plus a real SQLite database. On main, one child probed every path, hit the 10 s ETIMEDOUT and published no archive (twice); with this change 611 children probed at most 4,096 paths each, and both archives passed a standalone backup verify of all 2,502,506 entries, including the SQLite inventory (twice). Small-state controls pass on both refs, and the SQLite file is detected in every run. Details: #187197 (comment). Thanks @wr-web. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 2db1eb1) Release adaptation: Applied unchanged to the 2026.11.3 baseline. The existing worker, registry, runtime resolver, and Map consumer contracts are present-equivalent. The two requested timeout follow-ups are selected next in order. Companions: 81fc267 and 000542f are selected next. b2b3fbc is not applicable to this timeout fix: independent Windows busy-file retries and worker diagnostics. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e0ea97b9c104dc14f479d4eac3d5690cde2bfec1)
Identify probe timeouts with the discovery path count and manual update guidance. Document the installed-driver boundary for the 2026.10.10 hop. Refs #193962, #187197. Co-authored-by: steipete <[email protected]> (cherry picked from commit 81fc267) Release adaptation: Preserve the release documentation and insert only the selected timeout/installed-driver guidance; update the existing singleton timeout expectation to the new diagnostic. Existing errno helper and runtime worker contract are present-equivalent. Companions: 000542f is selected next. b2b3fbc (Windows busy-file retries), 691bc8d (engine-anchor capture), and 92798ae, c1e55e2, 715c610, 689cfc8, 86bc89e, 779c2e4, 31a65d5, e45e99d, 7c702c3 (independent update/Doctor/Git/recovery changes) are not applicable prerequisites. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4a4ac77e2bb2e1ebf7522d2d989edb714de13bfc)
Fixes #187150
What Problem This Solves
openclaw backup createsends every state-directory path to one isolated SQLite header-probe child with a fixed 10-second deadline. For sufficiently large state directories, the child times out and the backup aborts even though the files are readable.Bound the existing child's workload to 4,096 paths per invocation, giving each batch the same existing 10-second deadline. Keep deduplication, result validation, worker-process isolation and fail-closed behavior at the existing owner. The original wr-web commit is preserved.
User Impact
Large state directories can complete backup creation without a file-count-dependent single-child timeout. Backup format, source selection, SQLite classification, snapshot handling, error-message policy and per-child limits remain unchanged. A failed batch still aborts before archive publication.
Evidence
Linux built-CLI before/after proof, verified archive results and regression checks.
e9e4a75da55dff0fca7d751516b9ff8561c8c4d4; main baseline61e0cf581df7cea360bb7670b136e59b8d8105aa. Baseline identity verified against all 60,929 tracked source blobs. Built and exercised in secretless Node 24.22.1 Linux Docker.backup verify --jsonsucceeds on both archives, scanning 2,502,506 entries each with SQLite inventory verification.expected 1 to be greater than 1) after its classification and deduplication assertions pass.Simplification
Removed the extra probe helper, test-only exported batch-size constant, unrelated diagnostic-message expansion, and duplicate added test setup. Batching stays in the existing owner, worker arguments are resolved once, and results are inserted without per-entry map-pair allocations.
Final merge-base delta: production +34/−26 (60 changed lines, down from 75); tests +7/−8 (net −1).
Merge danger
Two-way door: reverting restores the previous probe scheduling without a migration. No backup-format or storage-policy change. Blast radius is SQLite header discovery during backup preparation; partial or failed probe batches still fail closed before an archive is published.