Skip to content

fix(reply): fix duplicate block replies by unblocking coalesced payloads#5080

Merged
jalehman merged 3 commits intoopenclaw:mainfrom
yassine20011:main
Feb 28, 2026
Merged

fix(reply): fix duplicate block replies by unblocking coalesced payloads#5080
jalehman merged 3 commits intoopenclaw:mainfrom
yassine20011:main

Conversation

@yassine20011
Copy link
Copy Markdown
Contributor

@yassine20011 yassine20011 commented Jan 31, 2026

Summary

This PR fixes a regression in which coalesced block replies were being incorrectly blocked by the duplicate detection logic introduced to prevent double-sending.

The fix ensures that payloads flushed from the block-reply-coalescer bypass the seen check in
Sendpayload.

These payloads are marked as seen when they first enter the coalescer queue, which makes it safe.

Related Issue

Fixes #3549

Changes

  • src/auto-reply/reply/block-reply-pipeline.ts
    • Updated createBlockReplyPipeline to accept a skipSeen flag in sendPayload
    • Passed true for skipSeen when flushing payloads from the coalescer

Testing

npx vitest run src/auto-reply/reply/agent-runner.heartbeat-typing.runreplyagent-typing-heartbeat.signals-typing-block-replies.test.ts

 RUN  v4.0.18 /home/yassineamjad/moltbot

 ✓ src/auto-reply/reply/agent-runner.heartbeat-typing.runreplyagent-typing-heartbeat.signals-typing-block-replies.test.ts (4 tests) 39ms
   ✓ runReplyAgent typing (heartbeat) (4)
     ✓ signals typing on block replies 22ms
     ✓ signals typing on tool results 4ms
     ✓ skips typing for silent tool results 1ms
     ✓ announces auto-compaction in verbose mode and tracks count 9ms

 Test Files  1 passed (1)
      Tests  4 passed (4)
   Start at  02:23:32
   Duration  3.51s (transform 1.62s, setup 1.70s, import 1.56s, tests 39ms, environment 0ms)

Greptile Overview

Greptile Summary

This PR adjusts the block-reply pipeline’s de-duplication behavior for coalesced block replies. Specifically, payloads that are enqueued into the coalescer are now marked as seen at enqueue time, and when the coalescer flushes it calls sendPayload with a flag to bypass the seenKeys check so the flushed payload can still be delivered.

This fits into the existing pipeline design that tracks seenKeys/pendingKeys/sentKeys to prevent double-sends while preserving ordering via sendChain and allowing coalescing/buffering stages to batch replies.

Confidence Score: 4/5

  • This PR looks safe to merge with low functional risk.
  • The change is narrowly scoped to the block-reply pipeline and aligns with the stated intent: mark coalesced payloads as seen at enqueue and bypass the seen-check on flush. I did not find a clear functional regression in the new logic from the diff; the main concern is maintainability/readability of the new flag, which could be misused later.
  • src/auto-reply/reply/block-reply-pipeline.ts

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

Context used:

  • Context from dashboard - CLAUDE.md (source)
  • Context from dashboard - AGENTS.md (source)

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 31, 2026

Additional Comments (1)

src/auto-reply/reply/block-reply-pipeline.ts
[P2] skipSeen parameter is inverted/unclear and easy to misuse. Right now sendPayload(payload, true) means “bypass seen”, but the default is also to mutate seenKeys inside sendPayload when not skipping. Consider renaming to something like bypassSeenCheck/skipSeenCheck and making it non-optional (default false) to make call sites self-explanatory and reduce the chance of accidentally skipping dedupe in future changes.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/block-reply-pipeline.ts
Line: 88:96

Comment:
[P2] `skipSeen` parameter is inverted/unclear and easy to misuse. Right now `sendPayload(payload, true)` means “bypass seen”, but the default is also to mutate `seenKeys` inside `sendPayload` when not skipping. Consider renaming to something like `bypassSeenCheck`/`skipSeenCheck` and making it non-optional (default `false`) to make call sites self-explanatory and reduce the chance of accidentally skipping dedupe in future changes.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@jalehman jalehman merged commit 6198909 into openclaw:main Feb 28, 2026
27 checks passed
@jalehman
Copy link
Copy Markdown
Contributor

Merged via squash.

Thanks @yassine20011!

zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 16, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman

(cherry picked from commit 6198909)
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 16, 2026
…ads (openclaw#5080)

Merged via squash.

Prepared head SHA: 399e125
Co-authored-by: yassine20011 <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman

(cherry picked from commit 6198909)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord: Duplicate messages being sent (double send)

2 participants