Repository navigation
Conversation
…times Runtime retention copied every owner-private file so it could never raise the link count of package recovery state (#187549). Under a private umask (077) every dependency file is owner-private, so a dev checkout copied all ~218k files (17.3 min in a benchmark of a 5.6 GB tree). Dependency package files hold no recovery state, so they are now hard-linked whatever their mode; the package's own files and dot-named package-manager entries keep the copy rule. Retained runtimes were also never reclaimed on hosts running other OpenClaw processes: any unscoped OpenClaw process counted as a holder. The creating updater now records its pid and start time, and cleanup releases processes that cannot be that creator (another identity, or started after the directory existed). Processes that reference the directory stay holders. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
Co-authored-by: obviyus <[email protected]>
|
Codex review: needs maintainer review before merge. What this changesThis PR hard-links owner-private dependency files during updater runtime retention and logs linked/copied counts. Example: An installation created under umask 077 contains node_modules/dep/index.js with mode 0600.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — suspected predecessor, not a causality claim: source commit Possible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a current retention bottleneck with a focused change and no actionable correctness findings. Removing creator custody resolves the previous review blockers. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherBefore replacing an installation, the updater inventories its running package and dependencies, materializes a private runtime, and binds imports and workers to that retained generation. flowchart LR
A[Running updater] --> B[Dependency inventory]
B --> C[Retention materializer]
C --> D[Linked dependency files]
C --> E[Independent protected copies]
D --> F[Retained runtime]
E --> F
F --> G[Updater imports and workers]
Technical reviewBest possible solution: Keep dependency eligibility in the existing retention materializer while preserving recovery, plugin-inspection, relocation, and copy-fallback safeguards. Do we have a high-confidence way to reproduce the issue? Current main's mode-only copy condition establishes the path for mode-0600 dependencies, supported by the author's benchmark and reported base-failing filesystem cases; this review did not execute the reproduction. Is this the best way to solve the issue? The narrowed patch removes unnecessary byte copying at its existing owner, preserves the original safety exceptions, and adds distinct layout regressions without new storage or cleanup machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 193053576b0a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +38, Tests +51, Other +2. Total +91 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (2 earlier review cycles)
Reviewed November 12, 2026, 2:00 AM ET / 07:00 UTC (Revision 3). |
…lative start Co-authored-by: obviyus <[email protected]>
|
Addressed in 4784935:
Not changed, with reasons:
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep this change to owner-private dependency linking and retention metrics. Creator-based reclaim needs SQLite-owned custody and upgrade proof. Co-authored-by: obviyus <[email protected]>
|
Split per review: creator-based reclaim custody (and its @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Closing: a full end-to-end update on APFS under umask 077 showed no retention-time improvement (248 s base vs 271 s with this change, both under load). Clone-backed copies are already cheap there; the cost is per-entry work across ~183k entries, not bytes. Following up on that per-entry cost instead. |
What
Runtime retention no longer copies every dependency file when the umask is private.
#187549 made retention copy owner-private files so it could never raise the link count of package recovery state. Under
umask 077every installed file is owner-private, so a dev checkout copied its wholenode_modules.Dependency package files hold no recovery state, so they are now hard-linked whatever their mode. That covers anything inside
node_modules/<pkg>ornode_modules/@scope/<pkg>, including pnpm's.pnpm/*/node_modules/<pkg>.These keep the copy rule:
distundernode_modules.pnpmmetadata,.openclaw.package-activation-*)Retention also logs
linked/copiedcounts. They were measured but never reported.Reclaiming abandoned retained runtimes while other OpenClaw processes run is split into a follow-up. That change needs SQLite-owned creator custody and upgrade proof.
Evidence
Retention benchmark (
prepareRetainedRuntimeFiles) on a copy of one dev checkout: 248,554 entries, 5.6 GB, all files mode0600, same host:0644The remaining copies are workspace packages inside the checkout (
extensions/*,packages/*), which keep the conservative rule. The fix run was taken under concurrent load, so its times are approximate.The
updater-runtime-retentionstep of a real managed update on that host (1,069 commits, base code) took 261.6 s of about 26 min.End-to-end update (correction to the benchmark above). Full
openclaw update --yeson isolated git checkouts underumask 077(APFS, same host, load average ~10–18), one commit ahead, run back to back:updater-runtime-retention43fc744b1c59a9On APFS the end-to-end retention time does not improve:
clone: "auto"copies are already copy-on-write clones, so hard-linking saves little there. The standalone benchmark's 17.3 → 4.9 min gap did not reproduce in a real update and should not be read as an update speedup. What this PR does change is that 114k dependency files are no longer duplicated on filesystems without clone support (ext4, NTFS); that disk and time effect is not measured here.Tests
update-retained-runtime-files.test.tsuses a real filesystem with owner-private files, for both a git checkout and a global package layout.nlink2).distand.package-lock.jsonkeepnlink1.package-update-retention.test.ts(the fix(update): stop runtime retention from hard-linking released activation journals that block later package swaps #187549 regression) still passes. Its owner-privatedistmodule keepsnlink=1.Accepted edge case
Workspace packages inside a checkout (
extensions/*,packages/*) are still copied when owner-private. They are the package's own files, and the copy rule exists to protect those.