Problem
On Windows, the Feishu channel fails to start with error 'Feishu runtime not initialized'.
Root Cause
When jiti loads the Feishu plugin, runtime.ts is loaded twice via different import paths:
- index.ts imports from ./src/runtime.js
- channel.ts imports from ./runtime
Even though these resolve to the same file, jiti caches them as separate module instances, creating two separate closures with different runtime stores. The setRuntime is called on one instance, but getRuntime reads from another.
Suggested Fix
Use a global variable to share the runtime store across all jiti module instances:
declare global {
var __feishuRuntimeStore: ReturnType<typeof createPluginRuntimeStore<PluginRuntime>> | undefined;
}
if (!globalThis.__feishuRuntimeStore) {
globalThis.__feishuRuntimeStore = createPluginRuntimeStore<PluginRuntime>('Feishu runtime not initialized');
}
const _store = globalThis.__feishuRuntimeStore;
Environment
- OS: Windows
- Node.js version: 22+
- OpenClaw version: latest
Problem
On Windows, the Feishu channel fails to start with error 'Feishu runtime not initialized'.
Root Cause
When jiti loads the Feishu plugin, runtime.ts is loaded twice via different import paths:
Even though these resolve to the same file, jiti caches them as separate module instances, creating two separate closures with different runtime stores. The setRuntime is called on one instance, but getRuntime reads from another.
Suggested Fix
Use a global variable to share the runtime store across all jiti module instances:
Environment