Problem
The majority of traces show 0ms duration. A small number show correct durations (18.3s, 78.6m etc). The 0ms traces mean a message:sent event fired with no matching entry in pendingConversations.
Root causes (likely multiple)
1. Heartbeat SKIP filter asymmetry
handler.ts skips message:received events matching /^Read HEARTBEAT\.md/ etc., but the subsequent message:sent (the HEARTBEAT_OK reply) still fires and tries to correlate — finding nothing, producing a 0ms trace.
Fix: also check SKIP on message:sent, or remove the pending entry on skip.
2. conversationId mismatch between receive and sent
If OpenClaw uses a different conversationId on the outbound event than the inbound (e.g. the reply gets a new ID), correlation fails. The sessionKey fallback in index.ts was added for webchat (#8) but handler.ts uses conversationId directly.
Fix: mirror the correlationKey() helper from index.ts into handler.ts — prefer conversationId, fall back to sessionKey.
3. System/gateway messages with no inbound pair
Announcements, cron outputs, proactive WhatsApp messages — these are outbound-only with no corresponding inbound event.
Fix: these are expected; filter them from the Traces view or mark them as type: outbound-only.
Suggested fix priority
- Port
correlationKey() fallback to handler.ts
- Add SKIP check to the
message:sent branch
- Consider suppressing 0ms traces from the main Traces view (or show with a distinct label)
Problem
The majority of traces show
0msduration. A small number show correct durations (18.3s, 78.6m etc). The 0ms traces mean amessage:sentevent fired with no matching entry inpendingConversations.Root causes (likely multiple)
1. Heartbeat SKIP filter asymmetry
handler.tsskipsmessage:receivedevents matching/^Read HEARTBEAT\.md/etc., but the subsequentmessage:sent(theHEARTBEAT_OKreply) still fires and tries to correlate — finding nothing, producing a 0ms trace.Fix: also check SKIP on
message:sent, or remove the pending entry on skip.2. conversationId mismatch between receive and sent
If OpenClaw uses a different
conversationIdon the outbound event than the inbound (e.g. the reply gets a new ID), correlation fails. ThesessionKeyfallback inindex.tswas added for webchat (#8) buthandler.tsusesconversationIddirectly.Fix: mirror the
correlationKey()helper fromindex.tsintohandler.ts— preferconversationId, fall back tosessionKey.3. System/gateway messages with no inbound pair
Announcements, cron outputs, proactive WhatsApp messages — these are outbound-only with no corresponding inbound event.
Fix: these are expected; filter them from the Traces view or mark them as
type: outbound-only.Suggested fix priority
correlationKey()fallback tohandler.tsmessage:sentbranch