You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dmwork adapter cannot distinguish between streaming block chunks and the final reply in its deliver callback because OpenClaw core's createNormalizedOutboundDeliverer() swallows the second info parameter.
Background
OpenClaw core provides a kind field via the second parameter of the deliver callback:
Discord receives info.kind correctly because it uses createReplyDispatcherWithTyping(), which passes (payload, info) directly to the deliver callback.
DMWork does not receive info.kind because it uses dispatchReplyWithBufferedBlockDispatcher(), which internally wraps the deliver callback with createNormalizedOutboundDeliverer():
// In reply-payload-*.js (OpenClaw core)functioncreateNormalizedOutboundDeliverer(handler){returnasync(payload)=>{// <-- only payload, info is dropped!awaithandler(normalizeOutboundReplyPayload(payload));};}
The wrapper only forwards payload, silently discarding the info argument. As a result, info is always undefined in the dmwork adapter's deliver callback.
Impact
Without info.kind, the adapter cannot distinguish streaming chunks from the final message. The previous workaround (draft-edit pattern using editMessage) caused issue #213 — forwarded/copied messages showing stale pre-edit content.
Possible Solutions
Upstream fix: Fix createNormalizedOutboundDeliverer to forward info:
Problem
The dmwork adapter cannot distinguish between streaming block chunks and the final reply in its
delivercallback because OpenClaw core'screateNormalizedOutboundDeliverer()swallows the secondinfoparameter.Background
OpenClaw core provides a
kindfield via the second parameter of thedelivercallback:block— intermediate streaming chunktool— tool call resultfinal— final complete replyDiscord receives
info.kindcorrectly because it usescreateReplyDispatcherWithTyping(), which passes(payload, info)directly to the deliver callback.DMWork does not receive
info.kindbecause it usesdispatchReplyWithBufferedBlockDispatcher(), which internally wraps the deliver callback withcreateNormalizedOutboundDeliverer():The wrapper only forwards
payload, silently discarding theinfoargument. As a result,infois alwaysundefinedin the dmwork adapter's deliver callback.Impact
Without
info.kind, the adapter cannot distinguish streaming chunks from the final message. The previous workaround (draft-edit pattern usingeditMessage) caused issue #213 — forwarded/copied messages showing stale pre-edit content.Possible Solutions
Upstream fix: Fix
createNormalizedOutboundDelivererto forwardinfo:Switch to
createReplyDispatcherWithTyping: Align with Discord's approach (larger refactor).Workaround (current PR fix: buffer deliver text and send once after dispatcher completes #214): Buffer all text in deliver, send once after dispatcher completes. Works but loses streaming typing effect.
Related