Skip to content

fix: split telegram reasoning and answer draft streams#20774

Merged
obviyus merged 19 commits intomainfrom
fix/telegram-dual-stream-lanes
Feb 20, 2026
Merged

fix: split telegram reasoning and answer draft streams#20774
obviyus merged 19 commits intomainfrom
fix/telegram-dual-stream-lanes

Conversation

@obviyus
Copy link
Copy Markdown
Contributor

@obviyus obviyus commented Feb 19, 2026

Before

Telegram draft edit streaming used one shared preview lane for both reasoning and answer updates.

What this broke

Reasoning and answer updates could overwrite each other. In some runs, the final answer edited the reasoning bubble or duplicated output.

Fix

  • Use separate Telegram draft streams for answer and reasoning lanes.
  • Route onPartialReply to answer lane and onReasoningStream to reasoning lane.
  • Finalize preview edits against the matching lane only.
  • Keep regression tests for cross-lane overwrite and lane separation.

Greptile Summary

Separated Telegram draft streams for reasoning and answer lanes to prevent content overwrites during streaming. The fix routes onPartialReply to answer lane and onReasoningStream to reasoning lane, ensuring each lane maintains independent preview messages.

Key changes:

  • Split single draft stream into separate answer/reasoning lanes with dedicated DraftLaneState tracking
  • Added reasoning-lane-coordinator.ts for think-tag parsing and reasoning/answer text splitting
  • Implemented finalizedPreviewByLane map to track preview finalization per lane
  • Enhanced draft stream with renderText support for HTML formatting
  • Added comprehensive regression tests for lane separation and cross-lane overwrite prevention

Issue found:

  • Reasoning lane finalization tracking incomplete when reasoning is sent as new message (not preview edit), causing cleanup logic to incorrectly clear successfully delivered reasoning messages

Confidence Score: 3/5

  • Safe to merge with minor fix recommended for reasoning lane cleanup
  • The PR successfully fixes the core issue of lane separation and has excellent test coverage. The logic bug around reasoning finalization tracking is minor and only affects cleanup in edge cases (reasoning-only finals sent as new messages). The refactoring is well-structured with clear separation of concerns via the new coordinator module.
  • Pay attention to bot-message-dispatch.ts:597-609 where reasoning lane finalization state tracking needs correction

Last reviewed commit: 813fd60

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: M maintainer Maintainer-authored PR size: L agents Agent runtime and tooling and removed size: M labels Feb 19, 2026
@obviyus obviyus self-assigned this Feb 19, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Feb 19, 2026
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Feb 19, 2026

@greptileai review please

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.

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread src/telegram/bot-message-dispatch.ts
Comment thread src/telegram/bot-message-dispatch.ts Outdated
@obviyus obviyus force-pushed the fix/telegram-dual-stream-lanes branch 2 times, most recently from e18206e to 3e4b463 Compare February 19, 2026 11:56
@obviyus obviyus marked this pull request as draft February 19, 2026 12:19
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL docs Improvements or additions to documentation channel: imessage Channel integration: imessage channel: zalo Channel integration: zalo gateway Gateway runtime extensions: lobster Extension: lobster cli CLI command changes security Security documentation commands Command implementations channel: feishu Channel integration: feishu and removed size: L labels Feb 19, 2026
@obviyus obviyus force-pushed the fix/telegram-dual-stream-lanes branch from 6e50409 to 91ad496 Compare February 19, 2026 14:49
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: imessage Channel integration: imessage channel: zalo Channel integration: zalo gateway Gateway runtime labels Feb 19, 2026
@obviyus obviyus force-pushed the fix/telegram-dual-stream-lanes branch from 813fd60 to 7458444 Compare February 20, 2026 05:39
@obviyus obviyus merged commit ab256b8 into main Feb 20, 2026
24 of 25 checks passed
@obviyus obviyus deleted the fix/telegram-dual-stream-lanes branch February 20, 2026 05:44
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Feb 20, 2026

Merged via squash.

@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Feb 20, 2026

ScreenRecording_02-20-2026.11-23-43_1.MP4

Previously, enabling /reasoning stream would disable answer streaming. Now it can stream both the reasoning and the response.

anisoptera pushed a commit to anisoptera/openclaw that referenced this pull request Feb 20, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
vincentkoc pushed a commit that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus

(cherry picked from commit ab256b8)

# Conflicts:
#	CHANGELOG.md
#	src/telegram/bot-message-dispatch.test.ts
#	src/telegram/bot-message-dispatch.ts
#	src/telegram/draft-stream.test.ts
#	src/telegram/draft-stream.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus

(cherry picked from commit ab256b8)

# Conflicts:
#	CHANGELOG.md
#	src/telegram/bot-message-dispatch.test.ts
#	src/telegram/bot-message-dispatch.ts
#	src/telegram/draft-stream.test.ts
#	src/telegram/draft-stream.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7458444
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant