Repository navigation
fix(plugins): preserve Bun source loader semantics - #150287
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: blocked before merge. Reviewed September 16, 2026, 11:16 PM ET / September 17, 2026, 03:16 UTC (Revision 9). ClawSweeper reviewWhat this changesPreserves plugin source-loading behavior across Bun and Node by adjusting module resolution, TypeScript and JSX transforms, and failed-import handling. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain This remains useful, maintainer-owned work. The previous Bun conditional-export blocker persists, and the latest source-SDK guard misses imports through helpers. Priority: P2 Review scores
Verification
How this fits togetherThe plugin loader turns plugin entrypoints and dependencies into executable registrations while keeping retained instances tied to their captured source. Runtime adapters select native loading or Jiti transformation before those modules execute. flowchart TD
A[Plugin entry and dependencies] --> B[Captured source generation]
B --> C[Runtime and source inspection]
C --> D[Native module loader]
C --> E[Jiti source transform]
D --> F[Plugin registrations]
E --> F
B --> G[Retained instance lifecycle]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +450, Tests +100, Other 0. Total +550 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve synchronous package selection and route source SDK graphs through their transform owner before evaluation, including helper imports, while retaining terminal failures and proving upgrade compatibility. Do we have a high-confidence way to reproduce the issue? Yes, source identifies focused failing paths: combine static and computed imports under a successful Bun probe, and load a CommonJS entry whose helper imports a source SDK with a TypeScript-backed JavaScript reference. These paths were not executed during this review. Is this the best way to solve the issue? No, not yet: extending the existing generation owner is appropriate, but whole-entry native selection and direct-only SDK inspection leave compatibility holes. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c939e56c3a75. LabelsLabel 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 (8 earlier review cycles)
|
63dfdae to
3985cac
Compare
3985cac to
2761acc
Compare
|
Merged via squash.
|
* fix(plugins): preserve Bun source loader semantics * fix(plugins): gate Bun native source resolution * fix(plugins): resolve source SDK peers natively * fix(plugins): keep source SDK modules on Jiti * fix(plugins): scope native source resolution * fix(plugins): scope source peer resolution * fix(plugins): isolate source SDK transforms
Concurrent remote workspace skill requests could call a Jiti handler before its static imports finished, producing readWorkspaceSkillsRequest errors. Extend the existing import-result cache to Node and separate the changed transform from legacy disk-cache output. Preserve native loading, lazy activation, and request authority. Regression proof covers cold and pre-existing transform caches. This extends the import-result preservation introduced in #150287.
Concurrent remote workspace skill requests could call a Jiti handler before its static imports finished, producing readWorkspaceSkillsRequest errors. Extend the existing import-result cache to Node and separate the changed transform from legacy disk-cache output. Preserve native loading, lazy activation, and request authority. Regression proof covers cold and pre-existing transform caches. This extends the import-result preservation introduced in openclaw#150287.
Bun can load OpenClaw's generated plugin artifacts natively, but its resolver and Jiti interop differ from Node at several boundaries: import conditions were lost, JSX and tsconfig settings were applied to captured paths, failed dynamic CommonJS imports could be evaluated twice, and an existing module's missing dependency was mistaken for a missing entry. Those differences broke valid TypeScript and CommonJS plugins or let retained generations observe the wrong module graph.
This change gives the plugin loader one Bun-specific adapter around the existing generation owner. It preserves import/require conditions, captures authored TypeScript edges before the alias map freezes, applies JSX and tsconfig behavior to captured source, memoizes Jiti's async import results without rewriting source text, and separates native entry resolution from evaluation so terminal failures are not retried. A synchronous capability probe keeps shipping Bun on its compatible Jiti path while runtimes with dynamic onResolve support keep computed imports lazy and native.
For Node, each plugin entry's authored references are inspected before loading. Only entries that import a source SDK alias are routed through Jiti, and those source SDK virtual modules remain under the same transform owner. This fixes Node 24.19's mixed require/import assertion without installing a process-wide resolver or changing Bun's native CommonJS path. Bun's resolver also covers OpenClaw's owned internal workspace packages. No dependency or public contract changes.
Validation:
pnpm check:changedtbx_01m2pbq6vffa4xkcdppgmd18gd)Release-note context: preserve generated plugin loading, TypeScript/JSX resolution, and failed dynamic CommonJS import behavior when OpenClaw runs on Bun.