Repository navigation
perf(plugins): resolve SDK aliases on demand - #139997
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 6, 2026, 5:53 AM ET / 09:53 UTC. ClawSweeper reviewWhat this changesThe plugin loader resolves SDK import targets individually, caches results within the existing loader generation, and retains complete alias maps for consumers that need them. Merge readiness✅ Ready for maintainer review This remains a useful performance change: current main and the latest release still prepare the complete SDK alias map on first demand. No blocking correctness or security defect was found in the introduced patch. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s plugin loader translates SDK imports into source or built module paths. These aliases feed native CommonJS, ESM, and source-transform loaders while preserving the plugin’s host and permitted SDK inventory. flowchart TD
A[Plugin SDK import] --> B[Registered parent scope]
B --> C[Permitted SDK inventory]
C --> D[Resolve requested artifact]
D --> E[Generation cache]
E --> F[Native module loader]
C --> G[Complete alias map on demand]
G --> H[Source transformer or build]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -5, Tests +81, Other 0. Total +76 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep SDK target discovery demand-driven within the existing cache generation, with the same permitted inventory and complete-map fallback for transformer consumers. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug reproduction: this is a performance optimization. Current source confirms the eager inventory traversal, and the captured body reports comparative runtime measurements. Is this the best way to solve the issue? Yes. Resolving individual targets through the existing prepared context removes unnecessary artifact checks without introducing a competing loader or changing public SDK exports. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8a29e7cd6323. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Merge verified main c5a7231, including openclaw#139997 on-demand SDK aliases and openclaw#139924 catalog timeout ownership. Preserve the Bedrock runtime, fixture and LLM export bytes. Documentation retains the existing scheduler guidance alongside disjoint main updates. The prior Bedrock HTTP and build checks passed; shared ACP cleanup and literal OAuth discovery failures require these canonical owner fixes. A fresh exact-head CI run follows this reviewed integration. Co-authored-by: Lucas Cardoso <[email protected]>
What Problem This Solves
A plugin importing one SDK entry pays to discover and validate targets for the entire SDK inventory. This adds avoidable cold import work and delays development Gateway readiness.
Why This Change Was Made
Resolve only the requested, permitted SDK subpath and keep the result (including a miss) within the existing loader generation. Native CommonJS and late ESM resolution use this prepared resolver; Jiti and build consumers still receive the complete alias map when they request it. Preserve source/dist selection, private-owner eligibility, both package spellings, parent-root boundaries and first-demand precedence for overlapping roots.
Remove the eager native alias enumerator and redundant map caches. Production changes total −5 lines; tests +81. The assertion budget also shrinks by two to reflect removed casts. No configuration, defaults, schemas, persisted state or public exports change.
User Impact
Less work when loading a small part of the SDK, with unchanged import and plugin behavior. Full-map consumers retain their existing path; this does not claim faster model inference.
Evidence
The cold cohort was interrupted after observation 92 by an incorrect output-size projection, then continued only the remaining observations. Original outcomes and the interrupted receipt are preserved; the helper workload did not change. Its initial environment inherited a service credential; an exact scan found zero output occurrences, and continuation excluded it. This is qualified, interrupted component evidence, distinct from the uninterrupted per-phase live measurements. Normal-build elapsed times are not treated as performance measurements. Two live observations per variant do not establish significance or population tails.