Problem
Issue #45994 documents a critical code-splitting bug where active-listener.ts is duplicated across 7 bundle chunks, each with an independent Map() instance. This breaks all proactive WhatsApp outbound sends while inbound and auto-replies work fine.
The community workaround (patching globalThis into each chunk) works perfectly — but gets overwritten on every npm update -g openclaw, leaving users silently broken again.
Proposal
Short-term: postinstall validation
Add a build-time or postinstall check that verifies critical singletons (active-listener.ts, and any others covered by PR #43683) are not duplicated across chunks:
// scripts/verify-singletons.js
const fs = require('fs');
const path = require('path');
const dist = path.join(__dirname, '..', 'dist');
const SINGLETONS = [
{ pattern: 'src/web/active-listener.ts', symbol: 'listeners' },
// add others from PR #43683
];
for (const { pattern, symbol } of SINGLETONS) {
const files = fs.readdirSync(dist, { recursive: true })
.filter(f => f.endsWith('.js'))
.filter(f => fs.readFileSync(path.join(dist, f), 'utf8').includes(pattern));
if (files.length > 1) {
console.error(`SINGLETON VIOLATION: ${pattern} found in ${files.length} chunks: ${files.join(', ')}`);
process.exit(1);
}
}
Long-term: Apply resolveGlobalSingleton() pattern to WhatsApp
PR #43683 fixed this exact bug class for Telegram, Slack, Signal, iMessage, and core pipeline singletons using resolveGlobalSingleton(Symbol.for(...)). WhatsApp's src/web/active-listener.ts was missed. Apply the same pattern.
Impact
This bug has been silently breaking WhatsApp outbound for users on v2026.3.12 and v2026.3.13. Multiple reports confirm it:
The workaround works but requires manual re-application after every update, which most users won't do.
Environment
- Confirmed on macOS arm64 (Node 24.12.0) and Linux (Node 22.22.0)
- Both npm and pnpm global installs affected
Problem
Issue #45994 documents a critical code-splitting bug where
active-listener.tsis duplicated across 7 bundle chunks, each with an independentMap()instance. This breaks all proactive WhatsApp outbound sends while inbound and auto-replies work fine.The community workaround (patching
globalThisinto each chunk) works perfectly — but gets overwritten on everynpm update -g openclaw, leaving users silently broken again.Proposal
Short-term:
postinstallvalidationAdd a build-time or postinstall check that verifies critical singletons (
active-listener.ts, and any others covered by PR #43683) are not duplicated across chunks:Long-term: Apply
resolveGlobalSingleton()pattern to WhatsAppPR #43683 fixed this exact bug class for Telegram, Slack, Signal, iMessage, and core pipeline singletons using
resolveGlobalSingleton(Symbol.for(...)). WhatsApp'ssrc/web/active-listener.tswas missed. Apply the same pattern.Impact
This bug has been silently breaking WhatsApp outbound for users on v2026.3.12 and v2026.3.13. Multiple reports confirm it:
The workaround works but requires manual re-application after every update, which most users won't do.
Environment