Repository navigation
fix(update): cleanup stalls when many artifacts share a large manifest - #174103
shoaibulhaque wants to merge 1 commit into
Conversation
Cleanup re-read, parsed, and serialized the same migration manifest for every artifact reference after confirmation. Large migration runs could keep the stopped Gateway offline for minutes before any file was removed. Compare each distinct run once against the manifest snapshots already read by the post-confirmation inventory. Keep the per-reference ownership and final artifact checks in their existing paths. Add retirement regressions for bounded manifest reads and confirmation-time metadata changes that must preserve the originals. Validation: 18 recovery mutation tests; doctor test graph typecheck; targeted Oxlint and oxfmt; independent P0-P2 review; git diff --check. Fixes openclaw#174072
|
🦞👀 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 changesCompare each shared recovery manifest once after confirmation while retaining existing artifact and ownership checks. Example: Multiple recovery artifacts reference one migration manifest.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete cleanup performance defect still present on current main; no actionable correctness or security findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe update cleanup CLI passes recovery inventory and consent to the Doctor retirement owner, which verifies offline ownership and preserved history before removing eligible rollback originals and recording disposal receipts. flowchart TD
A[Update cleanup CLI] --> B[Recovery inventory]
B --> C[Offline ownership and confirmation]
C --> D[Compare distinct manifests]
D --> E[Verify destinations and originals]
E --> F[Dispose originals and persist receipts]
Technical reviewBest possible solution: Land this focused optimization through the existing retirement owner while preserving cleanup eligibility and disposal safeguards. Do we have a high-confidence way to reproduce the issue? Current-main source establishes repeated whole-manifest work per reference, and the contributor supplies a release-versus-head installed-CLI comparison; this read-only review ran no target code. Is this the best way to solve the issue? Reusing the post-confirmation inventory directly removes the repeated work without adding another owner, changing persisted formats, or weakening final artifact checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b4ce369de7e8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +6, Tests +51. Total +57 across 2 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 7:28 AM ET / 11:28 UTC (Revision 2). |
|
@clawsweeper re-review Updated the PR body with installed-CLI cleanup evidence for the reviewed head: 35.51 s on released v2026.10.4 versus 4.44 s on the locally packaged and installed fix. Both runs removed 1,201 selected originals while retaining the protected original. Before/after database row hashes, settings, and protected-file hashes match; all 1,200 sessions remain readable with the release CLI. The body includes command output, fixture sizes, and the package/readback limitations. |
|
🦞👀 Re-review progress:
|
…rmation (#174249) openclaw update cleanup --yes re-read and re-serialized the whole session-SQLite migration manifest once per artifact reference while the Gateway was stopped (O(references x manifest); ~9 minutes for a 13 MB manifest with ~7,500 references). The confirmation re-check now compares each distinct manifest once against the already-read inventory, keeping the changed-during-confirmation safety. Production net -1 LOC. Live: cleanup removed 33 originals and preserved SQLite, config, and the protected file byte-for-byte. Supersedes #174103, thanks @shoaibulhaque. Fixes #174072 Co-authored-by: Shoaib <[email protected]>
…rmation (openclaw#174249) openclaw update cleanup --yes re-read and re-serialized the whole session-SQLite migration manifest once per artifact reference while the Gateway was stopped (O(references x manifest); ~9 minutes for a 13 MB manifest with ~7,500 references). The confirmation re-check now compares each distinct manifest once against the already-read inventory, keeping the changed-during-confirmation safety. Production net -1 LOC. Live: cleanup removed 33 originals and preserved SQLite, config, and the protected file byte-for-byte. Supersedes openclaw#174103, thanks @shoaibulhaque. Fixes openclaw#174072 Co-authored-by: Shoaib <[email protected]>
…rmation (openclaw#174249) openclaw update cleanup --yes re-read and re-serialized the whole session-SQLite migration manifest once per artifact reference while the Gateway was stopped (O(references x manifest); ~9 minutes for a 13 MB manifest with ~7,500 references). The confirmation re-check now compares each distinct manifest once against the already-read inventory, keeping the changed-during-confirmation safety. Production net -1 LOC. Live: cleanup removed 33 originals and preserved SQLite, config, and the protected file byte-for-byte. Supersedes openclaw#174103, thanks @shoaibulhaque. Fixes openclaw#174072 Co-authored-by: Shoaib <[email protected]> (cherry picked from commit a09c26b) Co-authored-by: RomneyDa <[email protected]>
Closes #174072
What Problem This Solves
Fixes prolonged Gateway downtime during update cleanup when many recovery artifacts share a large migration manifest.
User Impact
Cleanup can validate a shared manifest once, without repeating whole-file parsing and serialization for every artifact reference.
Why This Change Was Made
The post-confirmation inventory has already read the current manifests. Reuse those snapshots and compare each distinct migration run once before continuing with the per-reference ownership checks. Selection, destination verification, and final artifact checks still run through their existing owners.
Evidence
git diff --check: passed. GitHub production types, test types, lint, and theopenclaw/ci-gatecheck also passed on the reviewed head.Installed CLI behavior proof
Verified on Linux x86_64 with Node v24.18.0 and synthetic data only. The baseline is the npm-installed
OpenClaw 2026.10.4 (383c124). The fixed CLI is a local package built from this PR's exact head,ad229d086746bd5f46cc3f9181c1dc9edccb8377, using the repository's package script, then installed in a separate prefix. Its version output isOpenClaw 2026.10.4 (ad229d0). This package was not published.The fixture contains 1,200 legacy sessions, 2,400 transcript events, and one unknown original that must remain protected. Both independent states were imported through the installed v2026.10.4 Doctor command, with no import issues. The legacy source files are byte-identical. Manifests were produced by the importer and were not edited. Different absolute state paths make the manifests slightly different sizes: 2,343,888 bytes for the baseline and 2,394,358 bytes for the fixed run.
Commands used, with each binary pointing to its separate installation:
The runs were sequential on the same host, without overlapping cleanup work:
383c124ad229d0These times include process startup, ownership checks, verification, disposal receipts, and removal. This is one synthetic run per version, not the reporter's 13 MB inventory or a general benchmark.
Both actual cleanup reports returned
status: "complete". Selected fields from the fixed report:{ "status": "complete", "totals": { "candidateBytes": 0, "verificationRequiredBytes": 0, "protectedBytes": 48, "blockedBytes": 0, "removedBytes": 514801, "removedFiles": 1201 } }The preview selected 1,201 originals totaling 514,801 bytes. Cleanup removed all of them, left the 48-byte unreferenced original protected, and retained the migration manifest with disposal receipts.
Preservation was checked before cleanup, after cleanup, and again after CLI readback. Read-only SQLite checks showed identical canonical row hashes for all six history tables, including 1,200 session nodes, 1,200 session windows, and 2,400 transcript events.
PRAGMA quick_checkreturnedok. Configuration and protected-original hashes were also identical at all three points:The installed release CLI then read the cleaned state with
sessions --all-agents --limit all --jsonand returnedcount=1200,totalCount=1200,hasMore=false.Verification limits: the fixed package's separate
sessionscommand returned a generic CLI failure, so the readback above used the installed release CLI; it is not a claim that the fixed package passed session listing. The runtime-only build also lacks some plugin-SDK declaration exports, which the package script's final release-qualification check reported. Its generated package installed and ran cleanup successfully without payload or dependency-metadata edits. This is behavioral proof for cleanup, not release qualification. Initial restricted-sandbox attempts refused ownership inspection before removing any files; completed timings used normal host process permissions.Fixed package SHA-256:
b33730977e42e74464d82079fc376510f784b852913c482026cb9e7d129d4883.