Skip to content

[Bug]: Telegram progress bubble remains above subsequent assistant messages in progress streaming mode#92842

Closed
zhangguiping-xydt wants to merge 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/issue-90753
Closed

[Bug]: Telegram progress bubble remains above subsequent assistant messages in progress streaming mode#92842
zhangguiping-xydt wants to merge 2 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/issue-90753

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix classification: Root-cause fix.
  • Maintainer-ready confidence: High.
  • Root cause: Telegram progress mode used the answer draft lane as the state owner for progress drafts, but visible tool-output paths could send later assistant-visible messages or artifacts without first clearing that active progress draft from the same lane.
  • Why this is root-cause fix: The patch reuses the existing answer-lane progress clear/rotate lifecycle before visible tool output leaves the draft lane, so progress draft state is resolved at its source owner before later Telegram delivery.
  • What did NOT change: This only changes the progress-mode visible tool-output ordering boundary; it does not change Telegram streaming configuration, final-answer delivery, draft throttling, media/send formatting, security, auth, secrets, network, or tool execution behavior.
  • Fixes a Telegram progress-mode ordering hole where visible tool output or artifacts could be sent while the prior progress draft was still visible above them.
  • Keeps progress drafts owned by the answer draft lane, but clears/rotates that draft before visible tool output leaves the draft lane.
  • Success means progress/status bubbles are not stranded above later assistant-visible Telegram messages or artifacts in progress mode.
  • Reviewers should focus on the progress-mode tool-output lifecycle in extensions/telegram/src/bot-message-dispatch.ts.

Linked context

Closes #90753

Related #77727, #80862, #79804, #82089

Was this requested by a maintainer or owner?

  • No direct maintainer request. ClawSweeper kept the issue open and asked for focused Telegram progress-mode regression coverage plus direct proof that the progress bubble is not stranded above the final answer.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: Telegram direct-chat channels.telegram.streaming.mode = "progress" could leave the progress/status draft above later assistant-visible output when visible tool output or artifacts were sent.
  • Real environment tested: macOS 26.5, Node v24.15.0, pnpm 11.2.2, OpenClaw checkout 48bea40, real Telegram Desktop/App private chat with real bot @moongpbot, local OpenClaw gateway, and deterministic local OpenAI Responses mock provider.
  • Exact steps or command run after this patch:
pnpm openclaw gateway --port 19879
# Telegram private chat stimulus:
/verbose on
clean exec proof 1840
# Regression tests:
node scripts/run-vitest.mjs extensions/telegram/src/bot-message-dispatch.test.ts src/channels/progress-draft-compositor.test.ts
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):
2026-06-14T20:06:11.285+08:00 [gateway] ready
2026-06-14T20:06:12.551+08:00 [telegram] [default] starting provider (@moongpbot)
2026-06-14T20:06:13.873+08:00 [telegram] [diag] isolated polling ingress started

2026-06-14T20:09:06.704+08:00 [telegram] Inbound message telegram:<redacted-chat-id> -> @moongpbot (direct, 21 chars)
2026-06-14T20:09:11.801+08:00 [telegram] sendRichMessage ok chat=<redacted-chat-id> message=36
2026-06-14T20:09:13.576+08:00 [telegram] outbound send ok accountId=default chatId=<redacted-chat-id> messageId=37 operation=sendRichMessage deliveryKind=text chunkCount=1

Mock OpenAI provider request chain confirmed the real Telegram prompt drove an exec tool-call turn:

request #1: decision=exec-tool-call, hasTrigger=true, hasFunctionOutput=false, hasExec=true
request #2: decision=final-ok, hasTrigger=true, hasFunctionOutput=true, hasToolMarker=true, hasExec=true

Agent session output confirmed the tool and final model text were non-empty:

exec tool result: TELEGRAM_PROGRESS_TOOL_OUTPUT_OK
final assistant text: TELEGRAM_PROGRESS_CLEAN_OK no_stale_progress_bubble=true
  • Observed result after fix: the contributor-run runtime path completed through a real Telegram inbound message, real local OpenClaw gateway processing, an exec tool call, and two Telegram outbound sends. However, the local Telegram Desktop visual capture showed blank bot bubbles, so I am not attaching it and I am not claiming this as clean Mantis-quality visual proof.
  • What was not tested: the official maintainer Mantis/Crabbox Telegram proof was not run from this contributor environment, and I do not yet have a clean public screenshot/GIF showing the final Telegram UI without visual artifacts.
  • Proof limitations or environment constraints: this is contributor-run live Telegram/runtime evidence plus focused tests; visual Telegram proof remains inconclusive because the local client showed blank bot bubbles despite non-empty session output.
  • Before evidence (optional but encouraged): the focused visible-artifact regression failed before the round2 implementation with expected 13 to be less than 12, showing the draft clear happened after the Telegram send.

Tests and validation

Which commands did you run?

  • Extension-specific contract test command: node scripts/run-vitest.mjs extensions/telegram/src/bot-message-dispatch.test.ts -t "clears progress drafts before durable verbose tool output"
  • Extension-specific contract test command: node scripts/run-vitest.mjs extensions/telegram/src/bot-message-dispatch.test.ts -t "clears progress drafts before visible tool artifacts"
  • Fresh regression command after live proof: node scripts/run-vitest.mjs extensions/telegram/src/bot-message-dispatch.test.ts src/channels/progress-draft-compositor.test.ts

Fresh regression output after live proof:

Test Files  1 passed (1)
Tests  120 passed (120)

Test Files  1 passed (1)
Tests  10 passed (10)

[test] passed 2 Vitest shards in 10.17s

What regression coverage was added or updated?

  • Added clears progress drafts before durable verbose tool output in extensions/telegram/src/bot-message-dispatch.test.ts.
  • Added clears progress drafts before visible tool artifacts in extensions/telegram/src/bot-message-dispatch.test.ts.
  • The regressions cover progress mode, an active progress draft, visible tool text/artifact delivery, final answer delivery, and the ordering invariant that draft clear happens before Telegram delivery.

What failed before this fix, if known?

  • The durable-text regression failed before the first production fix because answerDraftStream.clear() was invoked after the first durable deliverReplies() call.
  • The visible-artifact regression failed before the round2 production fix because answerDraftStream.clear() was also invoked after the first visible artifact deliverReplies() call.

If no test was added, why not?

  • A regression test was added.

Risk checklist

Did user-visible behavior change? (Yes/No)

  • Yes. Telegram progress-mode users should no longer see a stale progress draft above later visible tool/final output in these visible tool-output paths.

Did config, environment, or migration behavior change? (Yes/No)

  • No.

Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)

  • No.

What is the highest-risk area?

  • Telegram progress-mode message lifecycle ordering when tool output becomes visible text or artifact output.

How is that risk mitigated?

  • The change only reuses the existing progress-draft clear/rotate path before visible tool sends in progress mode, and the focused acceptance tests cover draft stream behavior, Telegram dispatch ordering, and progress draft composition.

Current review state

What is the next action?

  • Ready for maintainer review after CI.

What is still waiting on author, maintainer, CI, or external proof?

  • CI and maintainer review. Contributor-run live Telegram proof has been added; maintainer-only Mantis/Crabbox proof was not run from this contributor environment.

Which bot or reviewer comments were addressed?

  • Addresses the ClawSweeper issue guidance requesting focused coverage for Telegram progress-mode ordering and proof that the progress draft is not stranded above later visible output.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 14, 2026, 8:24 AM ET / 12:24 UTC.

Summary
The PR clears and rotates Telegram progress-mode answer drafts before visible tool text or artifact output is sent, with regression tests for both delivery paths.

PR surface: Source +4, Tests +54. Total +58 across 2 files.

Reproducibility: yes. from source and regression modeling: current main can keep an active progress draft while a later tool payload is delivered, and the PR adds failing-before ordering tests for text and artifact tool outputs. I did not run a live current-main Telegram repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Proof head coverage: 1 stale visual run, 0 current-head visual runs. The second PR commit added the visible artifact path after the Mantis recording, so proof must be tied to the reviewed head.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger 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 current-head Telegram Desktop or equivalent live transport proof showing the progress bubble cleared before visible tool artifacts/tool text and the final reply.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: Contributor live logs show real Telegram traffic, but current-head visible ordering proof remains inconclusive and the prepared Mantis visual proof predates the artifact fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A current-head native Telegram Desktop recording would directly prove the visible progress-bubble ordering that logs cannot show. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram desktop proof: verify current head clears the progress bubble before visible tool text/artifacts and the final reply in Telegram progress streaming mode.

Risk before merge

  • [P1] Prepared Mantis visual proof was captured on the first PR commit and does not cover the later artifact-path commit at the current head.
  • [P1] The current-head live proof is log-based and does not visibly show that Telegram removed or rotated the progress bubble before subsequent visible messages.

Maintainer options:

  1. Refresh current-head Telegram proof (recommended)
    Capture current-head Telegram Desktop or equivalent live transport proof showing the progress bubble cleared before visible tool text or artifacts and the final reply.
  2. Accept source-only ordering risk
    Maintainers could merge based on source review, regression tests, and contributor logs while owning the remaining risk that the real Telegram UI still shows stale ordering.

Next step before merge

  • [P1] The remaining blocker is current-head Telegram-visible proof and maintainer review, not a narrow code repair.

Security
Cleared: No security or supply-chain-sensitive files are touched; the diff is confined to Telegram dispatch code and tests.

Review details

Best possible solution:

Land the narrow Telegram ordering fix only after current-head Telegram Desktop or equivalent live transport proof shows the progress bubble clearing before visible tool text/artifacts and the final reply.

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

Yes from source and regression modeling: current main can keep an active progress draft while a later tool payload is delivered, and the PR adds failing-before ordering tests for text and artifact tool outputs. I did not run a live current-main Telegram repro in this read-only review.

Is this the best way to solve the issue?

Likely yes as code direction: the PR reuses the existing answer-lane clear/rotate lifecycle at the visible tool-output boundary instead of adding a new transport path or config option. The unresolved blocker is current-head live visual proof, not a concrete wrong-layer code defect.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR targets a normal Telegram message-ordering bug with limited channel-specific blast radius.
  • merge-risk: 🚨 message-delivery: The diff changes when Telegram progress drafts are cleared relative to user-visible tool and final message delivery.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Contributor live logs show real Telegram traffic, but current-head visible ordering proof remains inconclusive and the prepared Mantis visual proof predates the artifact fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes user-visible Telegram chat ordering and is suitable for short Telegram Desktop proof.
Evidence reviewed

PR surface:

Source +4, Tests +54. Total +58 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 1 54 0 +54
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 60 2 +58

What I checked:

Likely related people:

  • Peter Steinberger: git shortlog shows the highest sampled commit count across Telegram dispatch tests and shared progress-draft compositor files. (role: area contributor; confidence: medium; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/bot-message-dispatch.test.ts, src/channels/progress-draft-compositor.ts)
  • Vincent Koc: Recent history includes Telegram dispatch/config/progress-adjacent work on the same sampled files. (role: recent area contributor; confidence: medium; commits: 8c802aa68351, 337fa8c956e9, 0fdf9e874b7e; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/bot-message-dispatch.test.ts, src/channels/progress-draft-compositor.ts)
  • Ayaan Zaidi: Recent Telegram stale-reply and visible-boundary commits overlap the draft/ordering lifecycle this PR changes. (role: recent adjacent contributor; confidence: medium; commits: dc3b10285db8, 5aad79571ee6, fe679f0a9095; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/bot-message-dispatch.test.ts)
  • Jason (Json): git blame currently attributes the reviewed visible tool-output branch in this checkout to commit 965fa05, which imported the current Telegram dispatch file shape. (role: recent importer/refactor contributor; confidence: low; commits: 965fa05df38b; files: 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.

@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 14, 2026
@openclaw-mantis

Copy link
Copy Markdown
Contributor

Mantis Telegram Desktop Proof

Summary: Mantis captured native Telegram Desktop before/after GIFs for Telegram progress message ordering.

Main screenshot This PR screenshot
Baseline native Telegram Desktop screenshot Candidate native Telegram Desktop screenshot
Main This PR
Baseline native Telegram Desktop proof GIF Candidate native Telegram Desktop proof GIF

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-desktop/pr-92842/run-27486343551-1/index.json

@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. and removed proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Jun 14, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

Superseded by #92998 with the same Telegram dispatch fix and a focused PR body.

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. proof: supplied External PR includes structured after-fix real behavior proof. 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.

[Bug]: Telegram progress bubble remains above subsequent assistant messages in progress streaming mode

1 participant