Repository navigation
improve: reduce memory when the catalog first captures plugin source - #206276
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: passed. What this changesThis PR bundles filesystem helpers into the broker attachments’ private build while preserving installed native assets and runtime-selected companion dependencies. Example: A packaged Linux x64 broker handles its first plugin source request.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep this PR open: it makes a focused, measured memory improvement using the existing build owner, and no actionable correctness or security defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe model catalog acquires plugin source custody through the native-resource broker; the build config packages its plugin and SQLite attachments, which create, retain, and release resources. flowchart TD
A[Model catalog] --> B[Native resource broker]
B --> C[Plugin source attachment]
B --> D[SQLite attachment]
C --> E[Private filesystem helper chunks]
D --> E
E --> F[Installed native libraries and assets]
Technical reviewBest possible solution: Use the existing selective bundling and package-URL transform for the broker attachments while retaining the broader ARM64 memory investigation separately. Do we have a high-confidence way to reproduce the issue? Current main excludes the broker attachment group from selective filesystem bundling, and the PR records matched packaged runs exercising the resulting external module evaluation; no target code was executed during this read-only review. Is this the best way to solve the issue? The change removes unnecessary module evaluation through the existing build owner, preserves companion export selection and installed asset lookup, and introduces no competing runtime or persistence mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ab7b31a13d9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +6, Other +3. Total +9 across 2 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:
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 Reviewed November 26, 2026, 8:24 PM ET / November 27, 2026, 01:24 UTC. |
|
Merged via squash auto-merge.
|
What Problem This Solves
When the catalog first asks the broker to own a plugin source, the broker evaluates 216 additional files from the installed
@openclaw/fs-safepackage. The files total 1,454,020 bytes. This happens while attaching the owner, before the first request to create a source directory.User Impact
The catalog can keep its source owner alive with a smaller broker process. In a packaged Linux x64 fixture, median broker PSS after the first source request fell from 67,662 to 59,960 KiB. Operator configuration and filesystem permissions stay the same.
Why This Change Was Made
The two broker attachment entry points already share private chunks. Bundle the filesystem code they use in that group. Native libraries and platform helper assets still resolve from the installed dependency. The logger and semver keep their runtime-selected exports. The normal compressed package grows by 65,127 bytes (124,125,394 → 124,190,521), with two additional private chunks. The global runtime, SDK and sealed workers keep their existing packaging.
Related: #192547
Evidence
Compared normal package builds from
3c6820c69e2aand35f1d307320a. The standalone broker ran on Node 24.22.1, Linux x64, one CPU, 2 GiB RAM, no swap and no network. Counts come from a separate module-evaluation probe. Timing and PSS come from six fresh, uninstrumented processes in stock/changed/changed/stock/stock/changed order. All six created and released real source directories and joined on close. Testbox allocationadvancedentry. The changed owner added zero. Both evaluated the same 33 external logger files. The SQLite entry was absent from this workload.