Repository navigation
improve(update): reduce POSIX package backup cleanup overhead - #188479
roboclaw-bot wants to merge 2 commits into
Conversation
Worked on by: - @MertBasar0 Co-authored-by: MertBasar0 <[email protected]> OpenClaw-Publication: 9325bc99-61df-45b5-9dc8-2e07104315c6
|
🦞👀 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 reuses a SQLite journal connection during each package-backup removal while preserving fresh intent and authority checks. Example: Retiring a previous package containing 2,000 files across 40 directories on Node 24.22.1.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a measured POSIX cleanup improvement that current main lacks, with no actionable correctness finding. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe POSIX package-publication owner removes obsolete package artifacts after activation; its journal supplies current intent, while the executor and filesystem owners enforce authority and object identity. flowchart TD
A[Installed updater] --> B[Publication owner]
B --> C[Scoped assertion reader]
C --> D[SQLite operation journal]
B --> E[Executor authority checks]
B --> F[Filesystem removal owner]
F --> G[Obsolete package artifacts]
Technical reviewBest possible solution: Use the existing rollback reader for each artifact-removal scope while retaining fresh journal reads and all existing mutation checks. Do we have a high-confidence way to reproduce the issue? Current-main source shows a new journal connection for each removal assertion, and the submitted interleaved workload quantifies that overhead; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch uses the existing reader and publication owners, removes repeated connection admission, and preserves current-record checks without introducing cached authorization or another cleanup path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0a5426f67f6a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +10, Tests +162, Other 0. Total +172 across 5 files. Added test files: 1. View PR surface stats
Review metrics
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 November 2, 2026, 3:50 PM ET / 20:50 UTC (Revision 2). |
Worked on by: - @MertBasar0 Co-authored-by: MertBasar0 <[email protected]> OpenClaw-Publication: 7cd9d2a6-7c1e-40fe-9ffe-976c71699351
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Related: #184658 (supporting research only; this does not diagnose or close the native Windows delay).
What Problem This Solves
POSIX npm updates do avoidable work while removing the previous installed package during final cleanup.
User Impact
Updates driven by a version containing this change spend less work retiring package backups, without changing configuration or migration requirements.
The installed updater owns this cleanup: installing the fixed candidate cannot accelerate an already-running older updater. Native Windows uses a different activation path and is not covered. The measured improvement below is for one cleanup phase, not total update time.
Why This Change Was Made
Reuse the existing admitted SQLite reader for one artifact's removal rather than opening a new journal connection for every removed entry. Every callback still reads the current journal record and checks object identity and live executor authority. Each read releases its snapshot; the retained connection closes on success or error before settlement or archival.
There is no cached authorization decision, reduced check frequency, deferred cleanup, or deadline change. Shared removal cadence, Windows compensation, updater-runtime retention, and terminal-output ordering remain unchanged. This isolates a POSIX-only cost found while supporting DonnieFi's investigation, not a competing Windows repair.
Evidence
The following commands and measurements were executed by Codex in Mert Başar's isolated Linux/WSL2/Docker environment. RoboClaw verified the source transfer and reused those receipts; it did not rerun or claim independent execution of the tests.
Measured baseline:
a0f10e38dea4244cfb22ad3f63139ef540e51587. Original measured candidate:d64336801477b849cb019c4bf721eedfdc5a6c3a. The transferred candidate files match their recorded SHA-256 values.Qualified cleanup measurements
Node 24.22.1, five serial interleaved baseline/candidate pairs, fresh process and fixture for each sample, the same committed 2,000-file / 40-directory workload, warm/uncontrolled filesystem caches, no profiler in this series.
No recorded median/p95 metric regressed by 20% or more. With five samples, nearest-rank p95 is the maximum, not a robust tail estimate. The original stronger preparation-scaling criterion is only partly met: the existing per-read journal-mode preparation remains. Total preparations are not constant.
The workload exercises real publication/retirement owners with private synthetic trees and an inert recovery-runtime fixture. It does not measure whole-update latency or establish a Windows/macOS improvement.
Reproducible workload and focused-test receipt
With supported Node 24.22.1 selected on PATH, the committed opt-in measurement entrypoint is:
The comparison retained this same workload for both variants, changing only the two production files between their pinned baseline and candidate versions. Source files were restored afterward.
Recorded focused-suite output:
The three added journal cases passed: intervening committed intent, replaced journal inode, and scope-end disposal. The four skips are existing macOS-only non-root ownership cases. Existing SQLite-owner proof covers snapshot-lock release and writer visibility. Targeted typecheck, lint, formatting, and patch checks passed on the donor candidate.
Packaged CLI boundary and retained limits
succeeded/finished. CLIpackageActivation.phasewascomplete. Function coverage bound to the original driver PID 84 recorded 3 executions ofcreateAssertionReader. This is execution coverage, not a CPU profile.CI follow-up: inventory callback identity
The original database-worker CI leaf failed because moving the existing validation callback changed its lexical operation name. The follow-up changes only the file-scoped reviewed entry from
openJournal.withDatabase.validatetoopenJournal.validate; existing CLI-only caller evidence, thresholds, guards, production code, and benchmark bytes are unchanged.RoboClaw ran the affected checks on Node 24.22.1: 124 tests passed across 3 inventory/ratchet/registry files, scoped format/lint and diff checks passed, and one normal
pnpm check:database-worker-ratchet --base a0f10e38dea4244cfb22ad3f63139ef540e51587invocation passed (T1 169 → 168; T1-compat 15 → 15). This is an original-branch-base comparison, not a replay of the failed CI merge. The prior CI failure remains recorded; newly triggered current-head CI is pending. Original cleanup measurements and packaged CLI proof remain attributed to the donor candidate above and were not rerun.Worked on by
Work sessions
The discussion and local implementation/verification sessions are private and are intentionally not linked at the requester's explicit direction. The source-bound evidence is summarized above; importing and publishing the candidate is not claimed as a new test execution.