Repository navigation
improve: reduce broker memory when loading plugin and SQLite resources - #206142
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: passed. What this changesBuilds plugin-capture and read-only SQLite broker attachments together in a private graph to reduce loaded code. Example: A packaged Linux x64 broker captures and releases a real plugin source.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a focused broker memory improvement that current main lacks; no actionable correctness or security defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe build registry supplies attachment entrypoints and chunks that the native-resource broker imports to serve plugin capture and SQLite snapshot requests. flowchart LR
A[Runtime entry registry] --> B[Build group planner]
B --> C[Private attachment graph]
C --> D[Native resource broker]
E[Plugin capture requests] --> D
F[SQLite snapshot requests] --> D
D --> G[Results and resource cleanup]
Technical reviewBest possible solution: Use the existing build-group owner for both attachments while keeping the broader ARM64 memory acceptance work open. Do we have a high-confidence way to reproduce the issue? Current main places both attachments in the shared runtime graph, and the broker dynamically imports them; the PR supplies matched packaged measurements of the resulting memory cost. Is this the best way to solve the issue? The change removes unnecessary shared-graph loading through the existing planner, preserves attachment entrypoints and code generation, and introduces no competing runtime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb8a2d2537d1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +17, Other +26. Total +43 across 4 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. 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 Reviewed November 26, 2026, 3:14 PM ET / 20:14 UTC. |
|
Merged via squash.
|
openclaw#206142) * improve(build): load less code when the broker attaches native resources * fix(build): group broker resources with the compatible helper
What Problem This Solves
The Gateway’s broker loads part of the Gateway bundle when it first captures a plugin source or opens a read-only SQLite resource. In the stock package, those attachments have 132 and 193 statically imported files respectively. The broker pays that cost in its own process.
User Impact
In three paired runs with the normal Linux x64 packages, median broker PSS after a real plugin source capture fell from 70,386 to 67,428 KiB (−2.89 MiB). Median time from startup through source release and broker shutdown fell from 288.9 to 260.9 ms. Operators get the change on update.
Why This Change Was Made
Both attachments run in the same isolate. Building them together gives their error classes and lifecycle helpers one private module graph. It preserves both public entry URLs, ordinary runtime code generation and retained-generation lookup. The unified build still produces the plugin ownership manifest.
Evidence
The private group ships 36 chunks. The complete package adds 360,376 compressed bytes (0.29%). All 933 ownership records matched the shipped files on both sides, with the same first-party module authorizations. The sealed worker archive was byte-identical.
c3b484b3still failed atagent.wait. The Gateway became ready at 33.601 s and acceptedchat.send, then the service hit 768.00 MiB and recorded three local OOM kills before any provider request or reply. The outer group peaked at 819.477 MiB and recorded zero local kills. The picker, UI and 60-second soak were never reached.0122e917and the byte-identical packaging diff in2c724b8d. The original measured patch was rebased onto broker squash0971864easc3b484b3. CI found that older TypeScript targets lack theMap.groupBydeclaration. The final head77a0e4feuses the existing build helper. All 79 ordering and subset checks over the 38 standalone entries produced byte-identical groups and output options on the two heads. Verification runRelated: #192547