Skip to content

fix(telegram): clear reasoning preview before forceNewMessage rotation (#80862)#97828

Merged
steipete merged 1 commit into
openclaw:mainfrom
ly-wang19:fix/telegram-reasoning-preview-split-80862
Jul 11, 2026
Merged

fix(telegram): clear reasoning preview before forceNewMessage rotation (#80862)#97828
steipete merged 1 commit into
openclaw:mainfrom
ly-wang19:fix/telegram-reasoning-preview-split-80862

Conversation

@ly-wang19

@ly-wang19 ly-wang19 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #80862.

With /reasoning stream, a second reasoning burst rotated the Telegram draft with forceNewMessage(). That discarded the prior preview's message id before terminal cleanup, so the superseded preview could remain visible indefinitely.

Why This Change Was Made

The current patch routes split reasoning through Telegram's existing rotateToNewMessageDeferringDelete() lifecycle. The stream captures the old bot message id, advances to a new generation, lets the replacement preview land, and deletes the superseded preview on its detached cleanup schedule. A shared dispatcher helper now applies the same reposition-and-reset invariant to reasoning splits and answer/tool-progress rotation.

This is preferable to clear-before-rotate: deleting first can make Telegram Desktop jump before the replacement appears, and dispatcher-owned deletion would duplicate the draft stream's in-flight-send and reply-target logic.

User Impact

Split reasoning previews no longer lose ownership of the prior Telegram message. Users should see the replacement preview and cleanup behavior instead of stale reasoning bubbles accumulating. Final answer delivery and durable messages are unchanged.

Evidence

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Jun 29, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 8:40 PM ET / July 11, 2026, 00:40 UTC.

Summary
The PR routes split Telegram reasoning previews through the existing deferred-delete repositioning primitive, refactors the tool-progress caller to share that helper, and adds focused dispatcher regression coverage.

PR surface: Source -4, Tests +31. Total +27 across 2 files.

Reproducibility: yes. at source level. Current main marks a streamed reasoning preview for rotation and then discards its message id through forceNewMessage() when the next reasoning segment starts, matching the linked issue's orphaned-preview report.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #80862
Summary: This PR is the active candidate fix for the canonical stale split-reasoning preview issue; the earlier exact candidate closed unmerged and has been superseded by the current shared-primitive approach.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted Telegram Desktop evidence showing the replacement reasoning preview appears before the prior preview is removed, with no stale preview or visible jump.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only mock-based test output is provided; add a redacted after-fix Telegram Desktop recording, transcript, or runtime logs, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.

Mantis proof suggestion
Native Telegram Desktop proof can directly verify replacement ordering, stale-preview cleanup, and viewport stability for the changed flow. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: reproduce split /reasoning stream output and record that the replacement preview appears before the prior preview is removed, with no stale preview or visible jump.

Risk before merge

  • [P1] No live Telegram evidence currently confirms that split reasoning previews are replaced, cleaned up, and kept viewport-stable under real Bot API and Telegram Desktop timing.

Maintainer options:

  1. Collect live split-reasoning proof (recommended)
    Run the two-segment reasoning flow in a real Telegram DM and verify replacement placement, superseded-preview cleanup, final message ownership, and viewport stability before merge.

Next step before merge

  • [P1] The current patch has no concrete code defect for automated repair; a maintainer should obtain or review live Telegram proof on the exact current head before merge.

Security
Cleared: The patch is confined to Telegram draft lifecycle code and tests and introduces no dependency, credential, permission, workflow, package-resolution, or supply-chain change.

Review details

Best possible solution:

Keep the shared deferred-delete integration, then land it after redacted Telegram Desktop proof shows the replacement reasoning preview appearing before the prior preview is removed, with no stale bubble or visible jump.

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

Yes, at source level. Current main marks a streamed reasoning preview for rotation and then discards its message id through forceNewMessage() when the next reasoning segment starts, matching the linked issue's orphaned-preview report.

Is this the best way to solve the issue?

Yes. Reusing the existing Telegram deferred-delete repositioning primitive is the narrowest maintainable fix and avoids creating a second cleanup lifecycle; only real-client behavior proof remains missing.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f68af6484665.

Label changes

Label changes:

  • add merge-risk: 🚨 message-delivery: The patch changes visible Telegram preview ownership and deletion timing, so real-client proof is needed to exclude stale, missing, or wrongly removed reasoning messages.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only mock-based test output is provided; add a redacted after-fix Telegram Desktop recording, transcript, or runtime logs, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.
  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible reasoning-preview placement and cleanup and can be directly demonstrated in a short Telegram Desktop recording.

Label justifications:

  • P2: This is a bounded Telegram preview-lifecycle regression affecting a specific reasoning-stream transition rather than core availability.
  • merge-risk: 🚨 message-delivery: The patch changes visible Telegram preview ownership and deletion timing, so real-client proof is needed to exclude stale, missing, or wrongly removed reasoning messages.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only mock-based test output is provided; add a redacted after-fix Telegram Desktop recording, transcript, or runtime logs, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible reasoning-preview placement and cleanup and can be directly demonstrated in a short Telegram Desktop recording.
Evidence reviewed

PR surface:

Source -4, Tests +31. Total +27 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 8 12 -4
Tests 1 31 0 +31
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 39 12 +27

What I checked:

Likely related people:

  • Peetiegonzalez: Authored the current-main commit that introduced and tested the Telegram post-new-then-delete-old repositioning primitive reused by this PR. (role: introduced deferred-delete behavior; confidence: high; commits: 3932f4abb45c; files: extensions/telegram/src/draft-stream.ts, extensions/telegram/src/draft-stream.test.ts, extensions/telegram/src/bot-message-dispatch.ts)
  • steipete: Was assigned this PR and force-pushed the current reasoning-lane integration, and has substantial recent history in the central Telegram dispatcher path. (role: recent implementation reviser; confidence: high; commits: e60a700a27d4, 3f402f2c4856; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/bot-message-dispatch.test.ts)
  • obviyus: Recently maintained Telegram draft-stream rendering and transport behavior adjacent to the lifecycle primitive used here. (role: recent adjacent contributor; confidence: medium; commits: f48ff25b3be3, e8b142feb117; files: extensions/telegram/src/draft-stream.ts, extensions/telegram/src/bot-message-dispatch.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-02T07:41:01.811Z sha feb0dbc :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 Jun 29, 2026
@ly-wang19
ly-wang19 force-pushed the fix/telegram-reasoning-preview-split-80862 branch from 7867253 to bd1064d Compare July 2, 2026 03:13
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 2, 2026
@ly-wang19
ly-wang19 force-pushed the fix/telegram-reasoning-preview-split-80862 branch from bd1064d to feb0dbc Compare July 2, 2026 07:23
@steipete steipete self-assigned this Jul 10, 2026
@steipete
steipete force-pushed the fix/telegram-reasoning-preview-split-80862 branch 2 times, most recently from a599f70 to 35eb189 Compare July 11, 2026 00:15
@clawsweeper clawsweeper Bot removed mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 11, 2026
@steipete
steipete force-pushed the fix/telegram-reasoning-preview-split-80862 branch from 35eb189 to e60a700 Compare July 11, 2026 00:25
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 11, 2026
@steipete

Copy link
Copy Markdown
Contributor

Land-ready proof for e60a700a27d445efc9c89e71517eff53c3cf379a:

Mantis rejected its own comparison because the baseline crop showed only the final static state and the candidate crop included Telegram side panes. That is an inconclusive capture, not a candidate product failure.

Residual risk is low-to-medium and confined to transient reasoning-preview timing: detached deletion is one-shot, and the deliberate defer window can briefly show both previews. Final answers, durable state, authentication, and unrelated messages are unaffected. The maintainer explicitly accepts the remaining visual-proof gap for landing.

@steipete
steipete merged commit 780f8d6 into openclaw:main Jul 11, 2026
125 of 130 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram uses multiple sendMessage previews instead of editMessageText, leaving stale reasoning messages

2 participants