Bug Description
Symptom: Discord messages take 33-122 seconds to process.
Log: "Slow listener detected: DiscordMessageListener took XX seconds"
Versions:
- Working: 2026.1.23-X
- Broken: 2026.1.24-3
Root Cause
PR #2266 (commit 3e07bd8, 2026-01-26) added Discord Presence Intents with a PresenceUpdateListener and in-memory cache. This causes cumulative delays on each message.
Fix Applied (Patch tested in Debian VM)
File: /home/alex/.npm-global/lib/node_modules/clawdbot/dist/discord/monitor/listeners.js
Before:
async handle(data, client) {
const startedAt = Date.now();
const task = Promise.resolve(this.handler(data, client));
void task
.catch((err) => { ... })
.finally(() => {
logSlowDiscordListener({ ... });
});
}
After:
async handle(data, client) {
const startedAt = Date.now();
const TIMEOUT_MS = 10_000;
let completed = false;
const task = Promise.resolve(this.handler(data, client));
const timeoutHandle = setTimeout(() => {
if (!completed) {
const logger = this.logger ?? discordEventQueueLog;
logger.warn("discord handler timeout, continuing", {
listener: this.constructor.name,
messageId: data.message?.id,
elapsedMs: Date.now() - startedAt,
});
}
}, TIMEOUT_MS);
void task
.catch((err) => { ... })
.finally(() => {
completed = true;
clearTimeout(timeoutHandle);
logSlowDiscordListener({ ... });
});
}
Bug Description
Symptom: Discord messages take 33-122 seconds to process.
Log:
"Slow listener detected: DiscordMessageListener took XX seconds"Versions:
Root Cause
PR #2266 (commit 3e07bd8, 2026-01-26) added Discord Presence Intents with a
PresenceUpdateListenerand in-memory cache. This causes cumulative delays on each message.Fix Applied (Patch tested in Debian VM)
File:
/home/alex/.npm-global/lib/node_modules/clawdbot/dist/discord/monitor/listeners.jsBefore:
After: