fix(whatsapp): restore config-driven block streaming for WhatsApp delivery#47391
Open
ignasicambra wants to merge 2 commits intoopenclaw:mainfrom
Open
fix(whatsapp): restore config-driven block streaming for WhatsApp delivery#47391ignasicambra wants to merge 2 commits intoopenclaw:mainfrom
ignasicambra wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Contributor
Greptile SummaryThis PR restores config-driven block streaming for WhatsApp by unwinding the hardcoded Key changes:
Observations:
Confidence Score: 4/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/whatsapp/src/auto-reply/monitor/process-message.ts
Line: 405-411
Comment:
**Consider belt-and-suspenders guard against reasoning leaks**
The previous code blocked every non-`final` kind in `deliver`, providing a second line of defense against reasoning/thinking content reaching WhatsApp. This PR removes that safety net and now relies solely on `shouldSuppressReasoningPayload` (which checks `payload.isReasoning === true`) in `dispatch-from-config.ts`.
If a reasoning payload were ever produced without `isReasoning: true` set — or a new code path were introduced that bypasses `dispatch-from-config.ts` — reasoning content would silently leak to WhatsApp end users with no fallback guard.
A low-cost additional check here would re-establish belt-and-suspenders protection without breaking the new block-streaming behavior:
```suggestion
deliver: async (payload: ReplyPayload, info) => {
if (info.kind === "tool" || payload.isReasoning) {
// Tool updates are internal-only; don't deliver to WhatsApp.
// Reasoning blocks are suppressed upstream by shouldSuppressReasoningPayload,
// but we guard here too in case that filter is ever bypassed.
return;
}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/whatsapp/src/auto-reply/monitor/process-message.inbound-contract.test.ts
Line: 304-334
Comment:
**Missing test case for `blockStreaming: false`**
Two of the three config-driven cases are now covered:
- `blockStreaming: true` → `disableBlockStreaming: false` ✓
- `blockStreaming` absent → `disableBlockStreaming: undefined` ✓
The third case — `blockStreaming: false` → `disableBlockStreaming: true` — has no corresponding test. Adding it would fully document and protect the inversion logic (`!account.blockStreaming`) at `process-message.ts:455`, ensuring a future accidental removal of the negation is caught immediately.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 2003dbd |
extensions/whatsapp/src/auto-reply/monitor/process-message.inbound-contract.test.ts
Show resolved
Hide resolved
xuwei-xy
pushed a commit
to xuwei-xy/openclaw
that referenced
this pull request
Mar 15, 2026
- openclaw#47391 fix(whatsapp): restore config-driven block streaming for WhatsApp delivery - openclaw#47388 fix(gateway): restore handshake timeout to 10s to fix devices list on slow systems, solve openclaw#47103
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
disableBlockStreaming: truefor WhatsApp to fix a reasoning/thinking content leak ([Bug]: Reasoning/thinking content leaks to WhatsApp channel #24954, [Bug]: Reasoning metadata leaking to WhatsApp messages #24605). This had the side effect of completely disabling block streaming — all messages are sent at once when the agent finishes, even whenblockStreamingDefault: "on"andblockStreamingBreak: "text_end"are configured.delivercallback now only suppresseskind === "tool"payloads (was suppressing everything except"final"). Reasoning blocks are already filtered upstream byshouldSuppressReasoningPayloadindispatch-from-config.ts:446, so they never reach the deliver callback.disableBlockStreamingis now config-driven from the per-accountblockStreamingsetting (was hardcodedtrue). When not configured, it falls through to the globalagents.defaults.blockStreamingDefault.shouldSuppressReasoningPayloadfilter indispatch-from-config.tshandles this. Tool payloads are still suppressed. The original bugs [Bug]: Reasoning/thinking content leaks to WhatsApp channel #24954 and [Bug]: Reasoning metadata leaking to WhatsApp messages #24605 remain fixed.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
disableBlockStreaming: true)User-visible / Behavior Changes
blockStreamingDefault: "on"andblockStreamingBreak: "text_end"are configured, WhatsApp now delivers messages progressively at text boundaries instead of batching everything at the end.channels.whatsapp.blockStreaming: true/falseconfig is now respected (was ignored since fix(whatsapp): suppress reasoning/thinking content from WhatsApp delivery #24962).Security Impact (required)
Repro + Verification
Environment
{ "agents": { "defaults": { "blockStreamingDefault": "on", "blockStreamingBreak": "text_end" } }, "channels": { "whatsapp": { "blockStreaming": true } } }Steps
Expected
Messages are delivered progressively at
text_endboundaries during streaming.Actual (before fix)
All messages are batched and sent at once when the agent finishes.
Evidence
pnpm test -- extensions/whatsapp/src/auto-reply/monitor/process-message.inbound-contract.test.ts)Human Verification (required)
blockStreamingDefault: "on"andblockStreamingBreak: "text_end"— blocks delivered progressively. Confirmed no reasoning content or tool call blocks leak to WhatsApp.shouldSuppressReasoningPayloadfiltering upstream); tool payloads still suppressed; unconfigured accounts fall through to global defaultReview Conversations
Compatibility / Migration
blockStreaming,blockStreamingDefault,blockStreamingBreak) are already defined; this PR makes WhatsApp respect themFailure Recovery (if this breaks)
channels.whatsapp.blockStreaming: falsein config, or removeblockStreamingDefaultfrom agent defaultsextensions/whatsapp/src/auto-reply/monitor/process-message.tsRisks and Mitigations
shouldSuppressReasoningPayloadindispatch-from-config.tswere ever removed or bypassed, reasoning blocks could leak to WhatsApp.