Skip to content

fix(telegram): clamp partial draft overflow#87644

Merged
obviyus merged 4 commits into
mainfrom
codex/telegram-draft-overflow-preview
May 28, 2026
Merged

fix(telegram): clamp partial draft overflow#87644
obviyus merged 4 commits into
mainfrom
codex/telegram-draft-overflow-preview

Conversation

@obviyus

@obviyus obviyus commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary:

  • Keep Telegram partial draft overflow in one editable preview instead of retaining rollover preview pages.
  • Preserve final overflow splitting so long final replies still deliver fully.
  • Add regression coverage for non-final overflow clamping and stop-time finalization of hidden overflow.

Verification:

  • pnpm test extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/lane-delivery.test.ts
  • git diff --check
  • Telegram bot-to-bot E2E with mock OpenAI on this branch

Real behavior proof:
Behavior addressed: Telegram partial draft streaming no longer emits multiple visible preview messages for one turn.
Real environment tested: Real Telegram bot-to-bot group transport with temp OpenClaw gateway and mock OpenAI.
Exact steps or command run after this patch: REPRO_GATEWAY_PORT=19979 REPRO_MOCK_PORT=19982 REPO_HEAD=$(git rev-parse --short=12 HEAD) node /tmp/repro-84885-telegram-partial.mjs
Evidence after fix: One mock POST /v1/responses; one reply-threaded SUT preview message; five edits to that preview; one final long-text overflow tail.
Observed result after fix: No preview rollover spam; only the final long reply tail used a second message.
What was not tested: Visual desktop recording.

Fixes #84885.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S maintainer Maintainer-authored PR labels May 28, 2026
@obviyus obviyus self-assigned this May 28, 2026
@clawsweeper

clawsweeper Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 28, 2026, 9:29 AM ET / 13:29 UTC.

Summary
The branch changes Telegram draft streaming to clamp non-final overflow into the current editable preview, preserves final overflow chunking on stop, and adds draft-stream regression tests.

PR surface: Source +42, Tests +93. Total +135 across 2 files.

Reproducibility: yes. The current-main source path is clear: an oversized non-final Telegram draft preview can enter the rollover/retain branch before finalization, and the linked issue includes release logs showing repeated preview sends.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Mantis proof suggestion
A native Telegram recording would materially help maintainers see the user-visible no-spam behavior during a long partial stream. 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 partial streaming keeps one editable preview during a long response and sends any overflow tail only at finalization.

Next step before merge

  • [P2] The protected maintainer label and linked beta blocker make this a maintainer landing decision, not an automated repair-lane task.

Security
Cleared: The diff only changes Telegram TypeScript runtime logic and tests, with no dependency, workflow, secret, or supply-chain surface added.

Review details

Best possible solution:

Land the focused Telegram draft-stream fix after maintainer and CI review, keeping one editable partial preview while preserving final overflow delivery.

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

Yes. The current-main source path is clear: an oversized non-final Telegram draft preview can enter the rollover/retain branch before finalization, and the linked issue includes release logs showing repeated preview sends.

Is this the best way to solve the issue?

Yes. The PR fixes the Telegram draft-stream owner path directly, gates rollover to finalization, and keeps final overflow splitting, which matches both the linked issue and the Telegram maintainer streaming note.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P1: This PR fixes a linked beta-blocking Telegram partial-streaming failure that can spam visible bot messages during real user turns.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix real Telegram bot-to-bot transport proof with the exact command and observed result showing one editable preview plus only a final overflow tail.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix real Telegram bot-to-bot transport proof with the exact command and observed result showing one editable preview plus only a final overflow tail.
  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram chat streaming behavior, so a short Telegram Desktop proof could directly show one preview being edited instead of multiple preview messages.

Label justifications:

  • P1: This PR fixes a linked beta-blocking Telegram partial-streaming failure that can spam visible bot messages during real user turns.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix real Telegram bot-to-bot transport proof with the exact command and observed result showing one editable preview plus only a final overflow tail.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix real Telegram bot-to-bot transport proof with the exact command and observed result showing one editable preview plus only a final overflow tail.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram chat streaming behavior, so a short Telegram Desktop proof could directly show one preview being edited instead of multiple preview messages.
Evidence reviewed

PR surface:

Source +42, Tests +93. Total +135 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 52 10 +42
Tests 1 99 6 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 151 16 +135

What I checked:

  • Repository policy applied: Root AGENTS.md and scoped extensions guidance were read, and the Telegram maintainer note specifically says streaming owns one visible preview message and Telegram behavior PRs need real Telegram proof. (.agents/maintainer-notes/telegram.md:10, a5eddb91bbd8)
  • Current main source-reproduces the linked bug path: On current main, oversized rendered preview text enters the rollover path before any final-state gate, resets to a new message, and retains the superseded preview, which matches the linked issue's source-level failure mode. (extensions/telegram/src/draft-stream.ts:206, a5eddb91bbd8)
  • PR implementation targets the right boundary: The PR gates overflow rollover to finalization, clamps non-final overflow to the current editable preview, and keeps final overflow state while rotating continuation messages. (extensions/telegram/src/draft-stream.ts:218, 4dc235428594)
  • Regression coverage covers clamp and finalization behavior: The PR adds tests for one editable non-final overflow preview, no retained non-final overflow pages, hidden overflow finalization, and multi-chunk final overflow after a clamped preview. (extensions/telegram/src/draft-stream.test.ts:417, 4dc235428594)
  • Merge shape is clean against current main: The read-only merge-tree check reported a merged result for the two touched Telegram files, and diff whitespace check returned clean output. (4dc235428594)
  • Proof and release state: The PR body reports a real Telegram bot-to-bot group transport run after the patch with one preview message, five edits, and only a final overflow tail; the PR head is not contained in any local release tag yet. (4dc235428594)

Likely related people:

  • obviyus: Ayaan Zaidi has multiple prior merged commits in Telegram draft streaming and message-state paths, including restoring partials, hardening streaming state, splitting answer/reasoning draft streams, and stabilizing draft boundary previews. (role: feature-history owner; confidence: high; commits: 37721ebd7ca9, a64d8d2d66ea, ab256b8ec71f; files: extensions/telegram/src/draft-stream.ts, extensions/telegram/src/draft-stream.test.ts, extensions/telegram/src/bot-message-dispatch.ts)
  • steipete: Peter Steinberger appears heavily in recent Telegram draft-stream history, including the default partial streaming change and shared draft-stream loop refactors that this code now depends on. (role: recent area contributor; confidence: high; commits: fc1787fd4bea, 3451159174c8, 27ae826f6525; files: extensions/telegram/src/draft-stream.ts, src/channels/draft-stream-controls.ts, src/channels/draft-stream-loop.ts)
  • vincentkoc: Current-main blame for the implicated draft-stream overflow block points at Vincent Koc's release-bound commit that added the present draft-stream file snapshot in this checkout. (role: current implementation provenance; confidence: medium; commits: 13dcded7c8e0, a5eddb91bbd8; files: extensions/telegram/src/draft-stream.ts, extensions/telegram/src/draft-stream.test.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 proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. labels May 28, 2026
@obviyus obviyus force-pushed the codex/telegram-draft-overflow-preview branch from 4dc2354 to fcddb1b Compare May 28, 2026 13:36
@obviyus obviyus merged commit bda924b into main May 28, 2026
84 of 92 checks passed
@obviyus obviyus deleted the codex/telegram-draft-overflow-preview branch May 28, 2026 13:38
@obviyus

obviyus commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

Landed via rebase onto main.

  • Scoped tests: pnpm test extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/lane-delivery.test.ts
  • Changelog: not updated; normal PR release context lives in this PR body/commit history.
  • Land commit: fcddb1b9a48d6e2e31cf4a045365eb8c5c40aa89
  • Merge commit: bda924b6390e7543fd41eb8b61c25a8419a4bc5d

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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beta blocker: telegram - partial draft previews can spam multiple visible messages for one turn

1 participant