Repository navigation
perf(plugins): read the generation registry from its leaf module - #206565
Conversation
- Move every getPluginRuntimeGenerationRegistry caller and mock from generation-scope to generation-state and delete the re-export. - The agent SQLite store worker no longer loads the full generation-scope graph (84 fewer modules before the first request).
|
🦞👀 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: passed. What this changesThis PR imports the generation-registry getter directly from its leaf module and removes its heavier re-export. Example: A one-shot openclaw agent --local turn reaches its first provider request.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR removes unnecessary cold-start imports through a complete internal cutover, with no actionable correctness or security defects found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin runtime readers obtain the registry selected by the current execution frame; harness lifecycle, provider discovery, hooks, and session initialization consume that registry without needing metadata-scope construction. flowchart TD
A[Local agent turn] --> B[Agent SQLite store worker]
B --> C[Harness lifecycle reader]
C --> D[Generation state leaf]
D --> E[Plugin execution frame]
E --> F[Selected generation registry]
Technical reviewBest possible solution: Use the existing leaf getter everywhere while preserving generation-scope construction and all registry-selection behavior. Do we have a high-confidence way to reproduce the issue? Current-main source shows the harness importing metadata-scope machinery solely to obtain the registry getter; the PR supplies repeated CLI module-load measurements supporting that unnecessary work. Is this the best way to solve the issue? This is the smallest complete repair: reuse the existing lightweight owner, migrate callers and mocks, and remove the import path that encouraged the excess loading. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 472abecd0045. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -4, Tests -3. Total -7 across 29 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 27, 2026, 5:19 AM ET / 10:19 UTC. |
…nclaw#206565) ## Problem `getPluginRuntimeGenerationRegistry` lives in `src/plugins/runtime/generation-state.ts`, but `generation-scope.ts` re-exports it, and callers imported it from there. `generation-scope` also loads metadata snapshots, invocation frames and registry creation. `src/agents/harness/registry-lifecycle.ts` needs only the getter, yet it pulls that graph into the agent SQLite store worker of every one-shot `openclaw agent --local` turn. ## Change - Every caller of `getPluginRuntimeGenerationRegistry` (6 production modules, 22 tests/test-support files) imports it from `generation-state.js`. Mocks that supplied the getter through a `generation-scope` mock now mock `generation-state`, so they still reach the code under test. - Delete the re-export from `generation-scope.ts`. Other `generation-scope` symbols are unchanged. No behavior change: the getter is the same function. ## Evidence - Module loads per thread before the first provider request, one fake-provider `agent --local` turn with a resolve/load trace in every thread, same base (main f353fd8 vs f353fd8 + this change), 2 runs each with identical counts: agent SQLite store worker 1,999 -> 1,915; all threads 14,870 -> 14,792. - `rg getPluginRuntimeGenerationRegistry` over src/extensions/packages/test: every reference resolves to `generation-state`. - Tests: one `ocx test` call over the 211 changed and importer test files: 2,819 passed, 1 skipped. Format and type-aware oxlint clean on all 29 changed files. - The openclaw#206466 gate counts processes, spawns and worker threads; none change here, so its budget is unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
getPluginRuntimeGenerationRegistrylives insrc/plugins/runtime/generation-state.ts, butgeneration-scope.tsre-exports it, and callers imported it from there.generation-scopealso loads metadata snapshots, invocation frames and registry creation.src/agents/harness/registry-lifecycle.tsneeds only the getter, yet it pulls that graph into the agent SQLite store worker of every one-shotopenclaw agent --localturn.Change
getPluginRuntimeGenerationRegistry(6 production modules, 22 tests/test-support files) imports it fromgeneration-state.js. Mocks that supplied the getter through ageneration-scopemock now mockgeneration-state, so they still reach the code under test.generation-scope.ts. Othergeneration-scopesymbols are unchanged.No behavior change: the getter is the same function.
Evidence
agent --localturn with a resolve/load trace in every thread, same base (main 238c6da vs 238c6da + this change), 2 runs each with identical counts: agent SQLite store worker 1,999 -> 1,915; all threads 14,870 -> 14,792.rg getPluginRuntimeGenerationRegistryover src/extensions/packages/test: every reference resolves togeneration-state.ocx testcall over the 211 changed and importer test files: 2,819 passed, 1 skipped. Format and type-aware oxlint clean on all 29 changed files.