fix(plugins): use module path for bundled jiti loads#70073
Conversation
Greptile SummaryThis PR fixes a one-line bug in Confidence Score: 5/5Safe to merge — the fix is a single correct argument substitution with a well-scoped regression test and no other touched paths. The change is minimal and precise (one argument), the regression test properly isolates the wiring contract by mocking getCachedPluginJitiLoader, cleanup in afterEach is thorough, and no other call sites or behaviors are touched. No P0/P1 issues found. No files require special attention. Reviews (1): Last reviewed commit: "fix(plugins): use module path for bundle..." | Re-trigger Greptile |
|
Related work from PRtags group Title: Open PR candidate: bundled plugin jitiFilename should use modulePath for #69783
|
1801175 to
06b7235
Compare
06b7235 to
a94c9b2
Compare
|
Landed via temp rebase onto main.
Thanks @yidianyiko! |
Summary
src/plugins/loader.tsstill passed the loader module URL asjitiFilename, which keeps the Bun-installed image-provider hang from [Bug]: Bun global install hangs in openclaw infer image providers while loading bundled image providers #69783 reproducible on latestmain.openclaw infer image providers --jsoncan hang before any image provider registers, which makesimage_generatelook unavailable in Bun global installs.createPluginJitiLoader(...)now passes the targetmodulePathasjitiFilename, and a focused regression test locks that wiring in.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
src/plugins/loader.tscalledgetCachedPluginJitiLoader(...)withjitiFilename: import.meta.urlinstead of the bundled plugin entrymodulePath, so Jiti resolved bundled runtime loads relative to the loader module rather than the target plugin module.jitiFilenamepassed bycreatePluginJitiLoader(...)for bundled runtime loads.Regression Test Plan (if applicable)
src/plugins/loader.jiti-filename.test.tsjitiFilenamewhen it asksgetCachedPluginJitiLoader(...)for a loader.getCachedPluginJitiLoader(...)isolates that contract without depending on a full Bun install.src/plugins/jiti-loader-cache.test.tscovers cache behavior once the caller passes a filename, but it did not cover the caller wiring insrc/plugins/loader.ts.User-visible / Behavior Changes
Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
openaibundled entrypoint was the direct import control sample)Steps
main, runpnpm test src/plugins/loader.jiti-filename.test.ts.jitiFilenameisfile:///.../src/plugins/loader.tsinstead of the bundled module path.Expected
jitiFilename.Actual
file:///data/projects/openclaw/src/plugins/loader.tsEvidence
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm test src/plugins/loader.jiti-filename.test.tsfailed before the fix on latestmainwith the wrongjitiFilename.pnpm test src/plugins/loader.jiti-filename.test.ts src/plugins/jiti-loader-cache.test.tspassed after the fix.timeout 8s openclaw infer image providers --jsonstill hangs in the already-installed Bun global package, confirming latest published install did not already contain this fix.src/plugins/jiti-loader-cache.test.ts.pnpm buildis still red locally on latestmaininscripts/stage-bundled-plugin-runtime-deps.mjsfor unrelated discord runtime-deps staging (discord-api-typesexact-version resolution).check:changedhook is also red on latestmainfrom unrelatedtsgo:coreerrors insrc/agents/pi-embedded-runner/compact.ts:887andsrc/agents/pi-embedded-runner/run/attempt.ts:1132.Review Conversations
Compatibility / Migration
Yes)No)No)Risks and Mitigations
import.meta.urlas the Jiti filename base.