fix(telegram): clear split reasoning previews#80959
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as duplicate/superseded: the same Telegram split-reasoning preview bug is already tracked by a canonical open PR, and this later branch adds no unique product or code surface worth keeping as a second competing fix. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Keep the remaining work on #80910 and land one narrow dispatch-path fix after live Telegram proof satisfies the streaming review standard. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main can simulate reasoning stream A, Is this the best way to solve the issue? No as a separate PR: the underlying fix direction is valid, but #80910 already owns the same bug on the same dispatch path and uses the existing lane-rotation helper. Security review: Security review cleared: The diff only changes Telegram draft cleanup logic, a focused test, and changelog text, with no new dependency, permission, secret, command execution, or network surface. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 33568988a6c1. |
Summary
/reasoning streamcan split reasoning into a fresh preview afteronReasoningEnd, but the dispatcher rotated the reasoning lane withforceNewMessage()before clearing the previous preview id.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
upstream/mainworktree, Telegram dispatcher/draft-stream source harness. No live Telegram bot token was used.env OPENCLAW_TEST_HEAVY_CHECK_LOCK_HELD=1 OPENCLAW_VITEST_MAX_WORKERS=1 pnpm --config.manage-package-manager-versions=false test extensions/telegram/src/bot-message-dispatch.test.ts extensions/telegram/src/draft-stream.test.tsonReasoningEnd; it verifies the first reasoning preview is cleared beforeforceNewMessage()and before the second reasoning preview update, while final cleanup still runs afterward.sendMessagereasoning previews with noeditMessageText/deleteMessagecleanup.Root Cause (if applicable)
splitReasoningOnNextStreamrotated the reasoning draft withforceNewMessage()and reset lane state, but did not clear the existing reasoning preview first.onReasoningEndis followed by another reasoning stream before final cleanup.Regression Test Plan (if applicable)
extensions/telegram/src/bot-message-dispatch.test.tsextensions/telegram/src/draft-stream.test.tsdraft-stream.test.tsstill covers the underlying clear/force-new behavior.User-visible / Behavior Changes
Telegram
/reasoning streamno longer leaves earlier split reasoning previews behind when another reasoning segment starts before final cleanup.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
/reasoning streambehavior from Telegram uses multiple sendMessage previews instead of editMessageText, leaving stale reasoning messages #80862Steps
onReasoningStream("<think>First</think>").onReasoningEnd().onReasoningStream("<think>Second</think>").Expected
Actual
Evidence
Human Verification (required)
env OPENCLAW_TEST_HEAVY_CHECK_LOCK_HELD=1 OPENCLAW_VITEST_MAX_WORKERS=1 pnpm --config.manage-package-manager-versions=false test extensions/telegram/src/bot-message-dispatch.test.ts extensions/telegram/src/draft-stream.test.tsenv OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm --config.manage-package-manager-versions=false run tsgo:extensionsenv OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 pnpm --config.manage-package-manager-versions=false run tsgo:extensions:testpnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/telegram/src/bot-message-dispatch.ts extensions/telegram/src/bot-message-dispatch.test.tsgit diff --checkReview Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations