Skip to content

Flush buffered Telegram finals after segmented delivery#83616

Closed
bpconnor3-r2 wants to merge 1 commit into
openclaw:mainfrom
bpconnor3-r2:codex/fix-telegram-buffered-final-flush
Closed

Flush buffered Telegram finals after segmented delivery#83616
bpconnor3-r2 wants to merge 1 commit into
openclaw:mainfrom
bpconnor3-r2:codex/fix-telegram-buffered-final-flush

Conversation

@bpconnor3-r2

Copy link
Copy Markdown

Summary

  • flush buffered Telegram final answers before returning from segmented final delivery
  • add a regression test for final answers split into hidden reasoning and visible answer segments

Root cause

When Telegram final output was split into reasoning/answer lane segments, the reasoning segment could be handled without sending a visible message. The visible answer was then buffered, but the segments.length > 0 path returned before flushBufferedFinalAnswer() ran, so automatic direct-message delivery could silently drop the final answer.

Validation

  • OPENCLAW_VITEST_INCLUDE_FILE=/tmp/openclaw-telegram-include.json node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-telegram.config.ts
  • Result: extensions/telegram/src/bot-message-dispatch.test.ts passed, 67 tests

Note: I also attempted the broader Telegram extension suite. This dispatch test file passed there as well, but the full suite reported unrelated existing failures in channel.gateway.test.ts startup probe handling plus runtime/token setup errors.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 18, 2026
@clawsweeper

clawsweeper Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as a duplicate: the same Telegram buffered-final flush is already tracked by the older open canonical PR, which has the linked root bug, the same code change, and a fuller regression scenario.

Canonical path: Close this duplicate draft and continue review, live Telegram proof, and any landing work on #53762.

So I’m closing this here and keeping the remaining discussion on #53762 and #53384.

Review details

Best possible solution:

Close this duplicate draft and continue review, live Telegram proof, and any landing work on #53762.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection and both PR tests show the path: a final payload split into reasoning and answer segments can leave reasoning only hinted, buffer the answer, and return from the segment branch before flushing; I did not execute tests because this review is read-only.

Is this the best way to solve the issue?

No for this PR as the merge vehicle. The code shape is plausible, but the same fix is already represented by the older canonical PR with the linked bug and fuller regression scenario.

Security review:

Security review cleared: The diff touches Telegram dispatch logic and a test only; it does not change dependencies, workflows, permissions, secrets handling, or package execution paths.

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame/log show the reasoning split, buffered-final helper, and adjacent Telegram dispatch paths were introduced or recently carried through commits 57c952f and 1ba9f5d. (role: recent area contributor; confidence: high; commits: 57c952f67985, 1ba9f5ded325; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/reasoning-lane-coordinator.ts, extensions/telegram/src/bot-message-dispatch.test.ts)
  • amitgaur: The older open canonical PR and the linked root bug are both by this contributor, and the PR commits carry the same flush plus a more detailed regression test. (role: canonical reporter and fix contributor; confidence: high; commits: 10046fb66ccc, b25e563bcb94; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/bot-message-dispatch.test.ts, CHANGELOG.md)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 35cd2af159f4.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 18, 2026
@clawsweeper

clawsweeper Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant