Skip to content

Telegram: keep verbose tool results separate from final answers#80294

Merged
jalehman merged 3 commits into
openclaw:mainfrom
jalehman:test/telegram-verbose-progress-lane
May 11, 2026
Merged

Telegram: keep verbose tool results separate from final answers#80294
jalehman merged 3 commits into
openclaw:mainfrom
jalehman:test/telegram-verbose-progress-lane

Conversation

@jalehman

@jalehman jalehman commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix Telegram verbose delivery so tool progress/results stay separate from the final assistant answer.

This addresses the live Telegram behavior where the final assistant response could edit/reuse the last verbose tool message, visually blending the tool output and final answer into one Telegram message.

What changed

  • Track answer-lane drafts that contain only tool progress text.
  • Rotate the Telegram answer draft before real final answer text is delivered.
  • Treat verbose tool-result deliveries (info.kind === "tool") the same way as progress-only drafts.
  • Add regressions for both progress callbacks and live verbose tool-result delivery.

Real behavior proof

  • Behavior or issue addressed: Telegram verbose tool progress/results were being reused as the final assistant answer message, making the final answer visually blend with tool output in Telegram.
  • Real environment tested: Josh's live OpenClaw Telegram setup on macOS, running the gateway from test/telegram-verbose-progress-lane with redacted live Telegram credentials.
  • Exact steps or command run after the patch: Cherry-picked both fix commits onto the live checkout, ran pnpm build, restarted the live gateway with launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway, then sent live Telegram turns that produced verbose tool progress/results followed by final assistant answers.
  • Evidence after fix: Copied live output from the OpenClaw setup showed openclaw gateway status --deep / gateway logs running from test/telegram-verbose-progress-lane at c3a3dfdd3a after the second restart, and the Telegram conversation showed the verbose tool-result message remaining separate while the final assistant answer was delivered as a fresh Telegram message.
  • Observed result after fix: The final assistant response no longer edited or reused the last verbose tool/progress message; tool output and final answer appeared as separate Telegram messages.
  • What was not tested: No known remaining gaps for the Telegram verbose progress/result separation; broad unrelated CI/test failures are tracked separately from this Telegram behavior proof.

Validation

pnpm test extensions/telegram/src/bot-message-dispatch.test.ts -t "verbose tool result|tool-progress-only|keeps progress updates"
# passed 3

pnpm test extensions/telegram/src/bot-message-dispatch.test.ts
# passed 41

git diff --check
# passed

pnpm exec oxfmt --check --threads=1 extensions/telegram/src/bot-message-dispatch.ts extensions/telegram/src/bot-message-dispatch.test.ts
# passed

pnpm tsgo:extensions:test
# passed

pnpm build
# passed on the live checkout after cherry-picking both commits

Notes

The live checkout has a pre-existing dirty generated Canvas bundle hash (extensions/canvas/src/host/a2ui/.bundle.hash). This PR intentionally does not include it.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S maintainer Maintainer-authored PR labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR adds Telegram answer-lane bookkeeping to rotate tool/progress-only drafts before final answer delivery, plus focused regression tests and a changelog entry.

Reproducibility: yes. Source inspection of current main shows tool/progress text can occupy the answer lane and final text can then finalize that same lane; the PR adds focused tests for progress callbacks and verbose kind: "tool" delivery.

Real behavior proof
Sufficient (live_output): The PR body reports after-fix live Telegram validation on a real macOS gateway with redacted credentials and observed separate tool-result and final-answer messages.

Next step before merge
The PR has a protected maintainer label and no narrow repair finding; the next action is normal maintainer review and CI, not a ClawSweeper fix PR.

Security
Cleared: The diff changes Telegram runtime lane bookkeeping, tests, and changelog only; it does not touch dependency, CI, install, secret, or supply-chain surfaces.

Review details

Best possible solution:

Land the focused Telegram dispatch/test fix after maintainer review and CI so verbose tool output remains a separate visible message from the final assistant answer.

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

Yes. Source inspection of current main shows tool/progress text can occupy the answer lane and final text can then finalize that same lane; the PR adds focused tests for progress callbacks and verbose kind: "tool" delivery.

Is this the best way to solve the issue?

Yes. The patch fixes the Telegram answer-lane transition directly, which is narrower than changing generic lane delivery or suppressing verbose tool output.

What I checked:

  • Current main can put tool progress in the answer draft lane: Current main writes formatted tool progress into answerLane.lastPartialText, marks answerLane.hasStreamedMessage = true, and updates the answer stream before final assistant text arrives. (extensions/telegram/src/bot-message-dispatch.ts:637, 9924fff1afc7)
  • Current main final text reuses the shared lane delivery path: Final answer segments fall through the same deliverLaneText answer-lane path unless progress mode uses its separate final sender, so a previous tool/progress draft can be finalized through that lane. (extensions/telegram/src/bot-message-dispatch.ts:1257, 9924fff1afc7)
  • Lane delivery finalizes the current streamed message in place: The lane text deliverer updates the current stream and stops/finalizes that same preview for final delivery, matching the reported blend when the answer lane still holds tool-only text. (extensions/telegram/src/lane-delivery-text-deliverer.ts:141, 9924fff1afc7)
  • PR rotates tool/progress-only drafts before final answer text: The patch adds activeAnswerDraftIsToolProgressOnly, prepares the answer lane for tool progress, rotates before final answer text, and handles verbose info.kind === "tool" deliveries. (extensions/telegram/src/bot-message-dispatch.ts:588, 13dad83e621a)
  • Regression tests cover both reported paths: The patch adds tests for tool-progress-only answer drafts and verbose tool-result drafts before final assistant answers, and updates progress-mode expectations to retain the tool draft separately. (extensions/telegram/src/bot-message-dispatch.test.ts:1116, 13dad83e621a)
  • Live PR metadata confirms protected maintainer routing: The PR is open, non-draft, mergeable, authored by a contributor, and labeled maintainer, proof: sufficient, and mantis: telegram-visible-proof.

Likely related people:

  • obviyus: Recent main history includes the core Telegram streaming/finalization commits closest to this answer-lane behavior, including finalizing streamed text in place and separating progress drafts from final replies. (role: Telegram streaming feature-history contributor; confidence: high; commits: bca16d0f00c0, 814b125f114c, 1367ec74616a; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/lane-delivery-text-deliverer.ts)
  • steipete: Recent history shows repeated Telegram dispatch/test and tool-progress display work in the same surfaces that this PR changes. (role: recent area contributor; confidence: high; commits: 11dc5cb94e9e, 69d446d1784c, ad1e6c448544; files: extensions/telegram/src/bot-message-dispatch.test.ts, extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/lane-delivery-text-deliverer.ts)
  • vincentkoc: Recent commits touched Telegram preview rotation and long-final reuse behavior, which are adjacent to this PR's stream rotation/final delivery path. (role: adjacent Telegram preview contributor; confidence: medium; commits: 1470b439e27c, e03fe1e28965, d5063d5b1632; files: extensions/telegram/src/bot-message-dispatch.ts, extensions/telegram/src/lane-delivery-text-deliverer.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9924fff1afc7.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 10, 2026
@jalehman jalehman force-pushed the test/telegram-verbose-progress-lane branch from c3a3dfd to 72a9b3d Compare May 10, 2026 16:57
@jalehman jalehman self-assigned this May 10, 2026
@jalehman jalehman force-pushed the test/telegram-verbose-progress-lane branch from 72a9b3d to 7c92053 Compare May 10, 2026 17:53
@jalehman jalehman force-pushed the test/telegram-verbose-progress-lane branch from 7c92053 to 613e841 Compare May 11, 2026 18:52
@jalehman jalehman merged commit 24ffd4d into openclaw:main May 11, 2026
81 checks passed
steipete pushed a commit that referenced this pull request May 12, 2026
* Telegram: keep tool progress separate from final answers

* Telegram: separate verbose tool results from final answers

* fix: separate Telegram verbose tool drafts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…claw#80294)

* Telegram: keep tool progress separate from final answers

* Telegram: separate verbose tool results from final answers

* fix: separate Telegram verbose tool drafts
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…claw#80294)

* Telegram: keep tool progress separate from final answers

* Telegram: separate verbose tool results from final answers

* fix: separate Telegram verbose tool drafts
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…claw#80294)

* Telegram: keep tool progress separate from final answers

* Telegram: separate verbose tool results from final answers

* fix: separate Telegram verbose tool drafts
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 mantis: telegram-visible-proof Mantis should capture Telegram visible proof. proof: sufficient ClawSweeper judged the real behavior proof convincing. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant