From 9181d1104705cb177b1e907a24da95117c577657 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 27 Jan 2026 17:55:28 +0000 Subject: [PATCH 1/2] fix: replace streaming content instead of appending Clawdbot gateway sends cumulative text with each delta event (full message so far), not incremental characters. The previous append logic caused duplicated/garbled text in chat nodes. --- src/integrations/clawdbot/collections.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/integrations/clawdbot/collections.ts b/src/integrations/clawdbot/collections.ts index 9531be9..89b854c 100644 --- a/src/integrations/clawdbot/collections.ts +++ b/src/integrations/clawdbot/collections.ts @@ -67,10 +67,10 @@ export function addAction(action: MonitorAction) { const streamingId = `${action.runId}-stream` const existing = actionsCollection.state.get(streamingId) if (existing) { - // Append content and update sessionKey if we learned it + // Replace content (gateway sends cumulative text, not incremental deltas) actionsCollection.update(streamingId, (draft) => { if (action.content) { - draft.content = (draft.content || '') + action.content + draft.content = action.content } draft.seq = action.seq draft.timestamp = action.timestamp From f5eb110123f05b95742ab8a24cd4108f99e93dda Mon Sep 17 00:00:00 2001 From: luccast <2213102+luccast@users.noreply.github.com> Date: Wed, 28 Jan 2026 09:32:07 -0500 Subject: [PATCH 2/2] docs: add comment about cumulative delta behavior --- src/integrations/clawdbot/protocol.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/integrations/clawdbot/protocol.ts b/src/integrations/clawdbot/protocol.ts index 632cec1..a7a8d97 100644 --- a/src/integrations/clawdbot/protocol.ts +++ b/src/integrations/clawdbot/protocol.ts @@ -60,6 +60,7 @@ export interface PresenceEntry { } // Chat events +// Note: gateway sends cumulative message content with each delta, not incremental chars export interface ChatEvent { runId: string sessionKey: string