Repository navigation
perf(plugins): reuse declared tool membership during resolution - #156205
Conversation
Punchcard-Session: ember-river-harbor-t4
|
🦞👀 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. |
|
@clawsweeper review Please review head 9f37641. The PR body includes the qualified functional evidence, paired performance tradeoffs, phase RSS limits, and final formatting-only source lineage. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
|
Codex review: blocked before merge. Reviewed September 24, 2026, 6:37 PM ET / 22:37 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch reuses each plugin record’s declared tool-name membership during registration and resolution, and updates plugin and Gateway tests for the internal representation and related persistence assertions. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: current main still lacks the optimization, and this member-authored PR is paired with an open issue. The code review found no actionable defect; a project maintainer still needs to decide whether the measured performance tradeoff is acceptable. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw reads plugin manifests and registrations to decide which tools an agent can use. The plugin resolver applies availability and name checks, calls tool factories, and returns the resulting agent tool list. flowchart LR
A[Plugin manifest declarations] --> B[Plugin registration]
B --> C[Declared tool membership]
C --> D{Available and allowed?}
D --> E[Plugin tool factories]
E --> F[Resolved agent tools]
Decision needed
Why: The native comparison establishes a bounded tradeoff, but the execution owner expressly did not claim project approval and production workload frequency is unknown. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +239. Total +238 across 11 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep lifecycle-scoped membership reuse if a project maintainer accepts the measured workload costs; otherwise adjust the representation while retaining one manifest owner and the current tool-selection contract. Do we have a high-confidence way to reproduce the issue? Yes for the performance mechanism: current-main source retains the repeated scans, and the linked native comparison exercises registration and resolution. This read-only review did not execute the benchmark. Is this the best way to solve the issue? Yes for the code boundary: the lifecycle-scoped membership projection removes repeated work without changing the documented manifest contract or factory freshness. Its measured operational cost still needs project acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3813c048eb7b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper review Please review head 9ddc44c. It integrates pinned main while preserving the original PR ancestry and composes the canonical exact-claim settlement notification with the real failure-receipt assertion. The PR body retains historical production proof and paired performance costs; new-head CI remains pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper review Please review head 0916cdf. It integrates the canonical main UI type repair813a while preserving the original PR ancestry. All eleven PR files and the main-relative PR diff are unchanged; the retained scoped source review applies. The PR body retains historical production proof and paired performance costs; new-head CI remains pending. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Execution-owner decision for head This records the execution owner's existing performance disposition, not human approval or a merge instruction. The production change remains unchanged from the originally published implementation; the retained native proof and subsequent test-only corrections keep their stated scopes. The accepted costs and benefits are the five-pair, candidate-minus-baseline results:
The reason to accept is the scoped removal of repeated declaration preparation and membership scans through the real registration/resolution path, with consistent large-tool gains. It does not establish a universal CPU or memory improvement or production workload frequency. Each fresh timing worker ran all eight ordered scenarios, with 25 warmups and 100 measured resolutions per row. Imports, setup, registration, first resolution, warmup, and explicit GC have distinct scopes; GC is outside the timed owner intervals. Shared-worker ordering limits attribution. Whole-worker peak RSS includes all rows and does not offset the phase RSS increases. Post-disposal RSS does not prove retained reachable allocations, a leak, or a GC cause. No startup, whole-VM, allocation-only, or net-memory claim is made. |
|
Source-only integration note for head The test-only conflict is in The resolution should retain main's fixture lifetime and At frozen main This note records source diagnosis only. It does not report a conflict resolution, integrated test run, or new-head native qualification. |
Punchcard-Session: ember-river-harbor-t4
|
Merged via squash.
|
* commit '0484d7a3ecf52589b0d3d98741e58e5f6b5bf661': (68 commits) fix(subagents): stop completion transcript retry loops (#157571) perf(sessions): remove duplicate foreground history reference scans (#157572) improve(typesafe): defer startup work until the first decision (#157380) fix(update): restore npm-pack helper typechecking (#157659) fix(packaging): avoid heap exhaustion on large bundles (#157471) refactor(infra): share process error handler registries (#157632) chore(ui): refresh control ui locales (#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (#157592) perf(plugins): reuse declared tool membership during resolution (#156205) fix(ui): pasted text previews fail before sending (#157390) fix(agents): wait for database resources during deletion (#157631) improve: move operator profile database reads off the Gateway thread (#155800) fix: explain rejected settings without losing edits (#157549) fix: keep Gateway responsive while recording trajectory events (#157598) fix(auth): show SIWC email and selected model account identity (#157629) docs: explain Codex app approval precedence (#155089) refactor(wizard): share select prompt requests (#157607) fix(ui): omit empty sections from conversation Markdown exports (#157590) fix(doctor): explain update lint supervisor refusals (#156547) fix(ui): GitHub folder links lose repository context (#157619) ...
* commit '0484d7a3ecf52589b0d3d98741e58e5f6b5bf661': (68 commits) fix(subagents): stop completion transcript retry loops (#157571) perf(sessions): remove duplicate foreground history reference scans (#157572) improve(typesafe): defer startup work until the first decision (#157380) fix(update): restore npm-pack helper typechecking (#157659) fix(packaging): avoid heap exhaustion on large bundles (#157471) refactor(infra): share process error handler registries (#157632) chore(ui): refresh control ui locales (#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (#157592) perf(plugins): reuse declared tool membership during resolution (#156205) fix(ui): pasted text previews fail before sending (#157390) fix(agents): wait for database resources during deletion (#157631) improve: move operator profile database reads off the Gateway thread (#155800) fix: explain rejected settings without losing edits (#157549) fix: keep Gateway responsive while recording trajectory events (#157598) fix(auth): show SIWC email and selected model account identity (#157629) docs: explain Codex app approval precedence (#155089) refactor(wizard): share select prompt requests (#157607) fix(ui): omit empty sections from conversation Markdown exports (#157590) fix(doctor): explain update lint supervisor refusals (#156547) fix(ui): GitHub folder links lose repository context (#157619) ...
* refactor(ai): share Mistral text delta appends * Merge main to incorporate the upstream update type fix * commit '0484d7a3ecf52589b0d3d98741e58e5f6b5bf661': (68 commits) fix(subagents): stop completion transcript retry loops (#157571) perf(sessions): remove duplicate foreground history reference scans (#157572) improve(typesafe): defer startup work until the first decision (#157380) fix(update): restore npm-pack helper typechecking (#157659) fix(packaging): avoid heap exhaustion on large bundles (#157471) refactor(infra): share process error handler registries (#157632) chore(ui): refresh control ui locales (#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (#157592) perf(plugins): reuse declared tool membership during resolution (#156205) fix(ui): pasted text previews fail before sending (#157390) fix(agents): wait for database resources during deletion (#157631) improve: move operator profile database reads off the Gateway thread (#155800) fix: explain rejected settings without losing edits (#157549) fix: keep Gateway responsive while recording trajectory events (#157598) fix(auth): show SIWC email and selected model account identity (#157629) docs: explain Codex app approval precedence (#155089) refactor(wizard): share select prompt requests (#157607) fix(ui): omit empty sections from conversation Markdown exports (#157590) fix(doctor): explain update lint supervisor refusals (#156547) fix(ui): GitHub folder links lose repository context (#157619) ... Co-authored-by: Vincent Koc <[email protected]>
…claw#156205) * perf(plugins): reuse declared tool membership during resolution Punchcard-Session: ember-river-harbor-t4 * test(plugins): preserve fixture contracts in CI Punchcard-Session: ember-river-harbor-t4 * test(gateway): join terminal persistence before claim assertions Punchcard-Session: ember-river-harbor-t4
* refactor(ai): share Mistral text delta appends * Merge main to incorporate the upstream update type fix * commit 'dda1f68bfa102cb804392c0e7cc22c0566a0944a': (68 commits) fix(subagents): stop completion transcript retry loops (openclaw#157571) perf(sessions): remove duplicate foreground history reference scans (openclaw#157572) improve(typesafe): defer startup work until the first decision (openclaw#157380) fix(update): restore npm-pack helper typechecking (openclaw#157659) fix(packaging): avoid heap exhaustion on large bundles (openclaw#157471) refactor(infra): share process error handler registries (openclaw#157632) chore(ui): refresh control ui locales (openclaw#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (openclaw#157592) perf(plugins): reuse declared tool membership during resolution (openclaw#156205) fix(ui): pasted text previews fail before sending (openclaw#157390) fix(agents): wait for database resources during deletion (openclaw#157631) improve: move operator profile database reads off the Gateway thread (openclaw#155800) fix: explain rejected settings without losing edits (openclaw#157549) fix: keep Gateway responsive while recording trajectory events (openclaw#157598) fix(auth): show SIWC email and selected model account identity (openclaw#157629) docs: explain Codex app approval precedence (openclaw#155089) refactor(wizard): share select prompt requests (openclaw#157607) fix(ui): omit empty sections from conversation Markdown exports (openclaw#157590) fix(doctor): explain update lint supervisor refusals (openclaw#156547) fix(ui): GitHub folder links lose repository context (openclaw#157619) ... Co-authored-by: Vincent Koc <[email protected]>
* refactor(ui): share slash-command failure results * Merge main to incorporate the upstream update type fix * commit '0484d7a3ecf52589b0d3d98741e58e5f6b5bf661': (68 commits) fix(subagents): stop completion transcript retry loops (#157571) perf(sessions): remove duplicate foreground history reference scans (#157572) improve(typesafe): defer startup work until the first decision (#157380) fix(update): restore npm-pack helper typechecking (#157659) fix(packaging): avoid heap exhaustion on large bundles (#157471) refactor(infra): share process error handler registries (#157632) chore(ui): refresh control ui locales (#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (#157592) perf(plugins): reuse declared tool membership during resolution (#156205) fix(ui): pasted text previews fail before sending (#157390) fix(agents): wait for database resources during deletion (#157631) improve: move operator profile database reads off the Gateway thread (#155800) fix: explain rejected settings without losing edits (#157549) fix: keep Gateway responsive while recording trajectory events (#157598) fix(auth): show SIWC email and selected model account identity (#157629) docs: explain Codex app approval precedence (#155089) refactor(wizard): share select prompt requests (#157607) fix(ui): omit empty sections from conversation Markdown exports (#157590) fix(doctor): explain update lint supervisor refusals (#156547) fix(ui): GitHub folder links lose repository context (#157619) ... * Merge frozen main to include the question fixture authority fix * commit '229ab8a1fe957d3d4822309a39ddf9c7ec616395': (25 commits) test(ui): capture live operator authority in guest question fixture refactor(agents): deslop runners, harness and recovery (#157294) fix(auth): preserve Copilot tenant credentials during Doctor repair (#139131) refactor(msteams): share stored service URL validation (#157706) fix(codex): honor configured tool PATH in native commands (#157290) refactor(msteams): share approval kind labels (#157705) fix(sessions): keep session results current during cold reads (#156121) fix(testing): capture bounded upgrade integrity diagnostics (#157535) refactor(i18n): reuse native branch candidate extraction (#157636) fix(update): preserve recovery files after ownership refusal (#148890) fix(test): prevent late announcements from contaminating registry tests (#157681) fix(e2e): scan full onboarding logs for prompts (#157624) refactor(session-tools): derive contracts from schemas (#156365) refactor(channels): derive config contracts from schemas (#156367) perf(test): reuse MCP archives and batch worker fixture copies (#157689) refactor: reuse prepared fixtures in slow core tests (#157685) refactor(codex): reuse marketplace reference selection (#157621) chore(ui): refresh control ui locales (#157710) docs(gateway): show how we build OpenClaw on Team (#157675) refactor: verify IRC surrogate chunking over loopback (#157580) ... * chore: merge frozen main prerequisite repairs Co-authored-by: Vincent Koc <[email protected]>
* refactor(ui): share slash-command failure results * Merge main to incorporate the upstream update type fix * commit 'dda1f68bfa102cb804392c0e7cc22c0566a0944a': (68 commits) fix(subagents): stop completion transcript retry loops (openclaw#157571) perf(sessions): remove duplicate foreground history reference scans (openclaw#157572) improve(typesafe): defer startup work until the first decision (openclaw#157380) fix(update): restore npm-pack helper typechecking (openclaw#157659) fix(packaging): avoid heap exhaustion on large bundles (openclaw#157471) refactor(infra): share process error handler registries (openclaw#157632) chore(ui): refresh control ui locales (openclaw#157573) fix(gateway): release remote Skills subscriptions when shutdown drains (openclaw#157592) perf(plugins): reuse declared tool membership during resolution (openclaw#156205) fix(ui): pasted text previews fail before sending (openclaw#157390) fix(agents): wait for database resources during deletion (openclaw#157631) improve: move operator profile database reads off the Gateway thread (openclaw#155800) fix: explain rejected settings without losing edits (openclaw#157549) fix: keep Gateway responsive while recording trajectory events (openclaw#157598) fix(auth): show SIWC email and selected model account identity (openclaw#157629) docs: explain Codex app approval precedence (openclaw#155089) refactor(wizard): share select prompt requests (openclaw#157607) fix(ui): omit empty sections from conversation Markdown exports (openclaw#157590) fix(doctor): explain update lint supervisor refusals (openclaw#156547) fix(ui): GitHub folder links lose repository context (openclaw#157619) ... * Merge frozen main to include the question fixture authority fix * commit 'dc64cc3a3a3cf38fff1e44c1d7af42a32929d7e4': (25 commits) test(ui): capture live operator authority in guest question fixture refactor(agents): deslop runners, harness and recovery (openclaw#157294) fix(auth): preserve Copilot tenant credentials during Doctor repair (openclaw#139131) refactor(msteams): share stored service URL validation (openclaw#157706) fix(codex): honor configured tool PATH in native commands (openclaw#157290) refactor(msteams): share approval kind labels (openclaw#157705) fix(sessions): keep session results current during cold reads (openclaw#156121) fix(testing): capture bounded upgrade integrity diagnostics (openclaw#157535) refactor(i18n): reuse native branch candidate extraction (openclaw#157636) fix(update): preserve recovery files after ownership refusal (openclaw#148890) fix(test): prevent late announcements from contaminating registry tests (openclaw#157681) fix(e2e): scan full onboarding logs for prompts (openclaw#157624) refactor(session-tools): derive contracts from schemas (openclaw#156365) refactor(channels): derive config contracts from schemas (openclaw#156367) perf(test): reuse MCP archives and batch worker fixture copies (openclaw#157689) refactor: reuse prepared fixtures in slow core tests (openclaw#157685) refactor(codex): reuse marketplace reference selection (openclaw#157621) chore(ui): refresh control ui locales (openclaw#157710) docs(gateway): show how we build OpenClaw on Team (openclaw#157675) refactor: verify IRC surrogate chunking over loopback (openclaw#157580) ... * chore: merge frozen main prerequisite repairs Co-authored-by: Vincent Koc <[email protected]>
Fixes #156203
What Problem This Solves
Plugin tool registration and resolution repeatedly rebuild or scan the same declared-name membership. Large tool sets pay this work for each registration and each resolved tool.
User Impact
Reduces repeated work for large plugin tool sets without changing tool availability, declaration validation, factory freshness, or returned order. This is a scaling repair, not a universal CPU or memory improvement: the common 35-tool batch case uses more warm CPU, and the 512-tool individual-registration case has higher phase RSS.
Why This Change Was Made
Keep one lazy, detached, trim-only and case-sensitive declaration Set per PluginRecord. Share it across that record's registrations, attaching it after PluginInstance wraps callable fields. Prepare raw media-name membership lazily once per plugin resolution. Keep the host array helper, produced-name arrays, unnamed-registration fallback, conflict short-circuit, and current factory/lifecycle behavior.
The declaration Set remains live with its registrations. The raw media Set is rebuilt per resolution; unnamed registrations materialize an availability array. These allocations have costs. The measured RSS differences do not identify retained objects or prove a leak, and this change makes no allocation-only or net-memory claim.
Evidence
Published integration
0e4b2c2ef3044580e72db829e98b033fe0130e1cpreserves the original PR ancestry and integrates main29b4f90bb6b813eeb72a07d034c57784b6f91077. Its tree is exactly the qualifiedf350bd3d2bd35328d9728d933caab7ad6a3c4859. The eight plugin postimages are unchanged; the Gateway test retains main's claim lifetime, blocked-writer barrier and joined cleanup, plus the stored failed-transcript assertion. Fresh native focused proof passed the complete persistence file: 9/9 cases, original order, no failed, pending or todo cases. The receiver verified selected source and frozen installation on Node 24.19.0 / Linux x64, pnpm 12.4.2 and Vitest 5.0.1; source and dependency checks remained stable through final closeout. The owned runner and processes are closed. A portal-sync timeout warning remains recorded separately from the successful test and closure evidence. Exact published-head CI remains pending; earlier CI and performance results below retain their stated source scope.ClawSweeper revision 5 completed for exact head
0e4b2c2ef3044580e72db829e98b033fe0130e1cat 2026-09-24 22:17 UTC (review run). It reports no actionable code or security findings and sufficient behavior proof. Its remaining maintainer-decision item repeats the measured scaling tradeoff already accepted in the execution-owner decision. That existing decision carries forward: all four production Git blobs are unchanged from0916cdf9d29f32e12c662fd647017bda6100c66bto this integration head: conversation-read-tools.ts (5e4c42f7db272176882e4bcbb62adcdcde0ba01d), registry-registrars-tools-hooks.ts (ea87f18e6e5962e780da0e952cb84b4b84b32415), registry-types.ts (377664d21edaa1472fa46826dc679e28b352dd2b), tools.ts (8087db29b30aeedb549118fbd42bf4a983f8724d). This records no new human approval. The disclosed CPU, RSS and registration costs, measurement limits and scoped acceptance remain unchanged.Retained native baseline/candidate proof used the real PluginInstance registration API and prepared-runtime tool resolution on Node 24.19.0 / Linux x64. Before the subsequent test-only corrections, candidate passed all 261 leaves across six files; baseline passed 258 and failed the three intended regression assertions. Both arms have the same leaf inventory, including duplicate-title multiplicity. Three baseline fixture emission bindings adapt only the original private array representation; assertion/input order is unchanged. Eight functional commands and twelve measurement workers completed, with matched source/dependency endpoints and complete owned-process/provider closeout. A preceding timed-out attempt contributes no functional or measurement credit.
Independent review of the production change found no actionable P0–P2 findings. The measured production logic remains unchanged. Later changes are formatter line wrapping, an explicit return type for a deliberately throwing test getter, and a verbatim extraction of the optional-tool registry fixture into a sibling test helper. The fixture extraction preserves every test body, assertion and hook order. The Gateway persistence test now waits for main's canonical exact-claim settlement notification, asserts no persistence warnings, and verifies the stored failure receipt before checking the clear-requested owner state. It retains the blocked-writer assertion and original case order; the superseded persistence spy is removed. The retained functional proof predates these test corrections; fresh scoped reviews found no actionable P0–P2 findings.
Historical CI for PR head
128fbd9250aand native hosted preparation passed. The CI checkout was merge2958af493ef20c107a5d6eb6e7ba25cba17ef753(PR head128fbd9250a745293737d81bb2d14ca02ac82be3with base80bab7e23ce05a0cf68f4f54d38f8702d0238d35), using Node 24.19.0 / Linux x64 and Vitest 5.0.0. Actual shard plans and test output confirm the full persistence file: 9/9 cases, persistence-owner sibling: 13/13, and run-failure sibling: 23/23 passed. The persistence file ran in its original case order, including the blocked-writer and repaired settled-failure case; the repaired block is unchanged in that merge checkout. The required combinedopenclaw/ci-gatestatus and native merge verification subsequently passed for that head. A later conflict with main's settlement-notification repair was resolved by integrating pinned main2e9a2eceb11bd937a64dc01fb7894ff23eb80ef7, retaining its canonical notification and the failure-receipt assertion. Signed integration head9ddc44ce6165069cc127c8b0236cab764fe014efpreserves the original PR ancestry. Its core type-check job then failed on a UI route-loader type error. The failing file is byte-identical in the pinned main, CI base, PR head and CI merge. The canonical main fix813a10e7debis integrated in signed head0916cdf9d29f32e12c662fd647017bda6100c66b. All 11 PR files and the main-relative PR diff remain byte-identical; the existing scoped source review applies. Historical head CI and native hosted preparation passed for0916cdf9d29f32e12c662fd647017bda6100c66b. A separate native focused run passed the complete persistence file, 9/9 cases in original order, including blocked-writer, queued end/cancellation/settled-failure and native cancellation cases. Exact head/tree/file, frozen installation, Node 24.19.0 / Linux x64, pnpm 12.4.0 and Vitest 5.0.0 were verified, with stable source endpoints and complete provider/process/source/install closeout. That CI also proves the persistence-owner sibling: 13/13. The earlier 45-case results, including run-failure 23/23, remain historical evidence for their stated merge checkout.Untimed delegated-work counts are separate from timing. At 512 tools, 100 warm resolutions replace 26,214,400 declaration-array entries with 51,200 Set membership calls. Individual registration reads the declaration source 512 times on baseline and once on candidate (262,144 versus 512 entries). Raw media checks replace 51,200 Array.includes calls with one Set construction per resolution reading 51,200 source entries; native includes comparison counts were not measured.
Timing uses five same-ordinal serial AB/BA pairs, each worker running all eight rows in the same order. Individual means separate registrations; batch means one factory registration producing the tool set. After 25 warmups, each warm interval contains 100 resolutions. The table reports the median of the five paired percentage changes (candidate versus baseline), not a ratio of arm medians.
Both 512-tool shapes improve warm wall and CPU in all five pairs. Tiny rows have mixed signs. The 35-tool batch warm CPU is higher in every pair (+2.56% to +77.97%); its paired median increase is 8.524 ms per 100 resolutions.
Registration, first resolution, warmup, imports and fixture/setup are distinct phases. The 512-tool batch registration total (first plus remaining registration intervals) rises by paired medians of 1.568 ms wall and 8.051 ms CPU, higher in all five pairs. Its first resolution improves by paired medians of 12.730 ms wall and 22.140 ms CPU. These phase medians are not summed into a net estimate.
Memory is mixed. After the 512-tool individual row's warm phase, paired current RSS rises by a median 142.45 MiB (137.71–182.63); after joined owner/cache disposal it remains higher by 138.94 MiB (129.06–174.90), in all five pairs. Whole-worker peak RSS is lower in four of five pairs, with paired median -13.91 MiB (range -86.03 to +37.04). The peak covers imports, setup, all eight rows, validation and disposal; it is not a per-row peak. Explicit paired GC points measure process-wide retained heap around registration with the owner strongly held, outside CPU/wall timing; they do not attribute the RSS increase or measure allocated bytes.
No production-frequency, startup, whole-VM, uniform CPU, overall RSS, or leak-causation claim.