Skip to content

Fix Telegram preview retention on generation mismatch - #85825

Closed
NianJiuZst wants to merge 1 commit into
openclaw:mainfrom
NianJiuZst:codex/issue-85807-telegram-preview-retain
Closed

NianJiuZst wants to merge 1 commit into
openclaw:mainfrom
NianJiuZst:codex/issue-85807-telegram-preview-retain

Conversation

@NianJiuZst

Copy link
Copy Markdown
Contributor

Summary

Verification

  • node scripts/run-vitest.mjs extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/bot-message-dispatch.test.ts
  • node scripts/github/real-behavior-proof-check.mjs with a local PR payload body matching this draft.

Real behavior proof

Behavior addressed: Telegram preview messages that land during a generation-mismatch race are preserved instead of being deleted.
Real environment tested: Local OpenClaw checkout on macOS, Telegram draft-stream code path.
Exact steps or command run after this patch: node scripts/run-vitest.mjs extensions/telegram/src/draft-stream.test.ts extensions/telegram/src/bot-message-dispatch.test.ts
Evidence after fix: Terminal capture from the focused Telegram regression lane:

 RUN  v4.1.7 /Users/nianjiu/openclaw

 Test Files  2 passed (2)
      Tests  116 passed (116)
   Start at  04:24:53
   Duration  6.84s (transform 4.70s, setup 189ms, import 330ms, tests 6.21s, environment 0ms)

Observed result after fix: The generation-mismatch path now emits retain: true, matching the existing overflow-preview retention contract.
What was not tested: Live Telegram DM delivery against a production bot.

@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 May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: the patch is a narrow, source-backed Telegram message-retention fix and current main still lacks the added retain:true. The overlapping #85808 tracks the same bug, but this branch is the smaller safer landing candidate after the later force-push; it still needs real Telegram proof before merge.

Canonical path: Close this PR as superseded by #85808.

So I’m closing this here and keeping the remaining discussion on #85808.

Review details

Best possible solution:

Close this PR as superseded by #85808.

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

Yes for source-level reproduction: current main has a generation-mismatch callback that omits retain, and the dispatch callback deletes non-retained superseded previews. I did not run a live Telegram reproduction in this read-only review.

Is this the best way to solve the issue?

Yes with a proof caveat: adding retain: true at the generation-mismatch callback is the narrow maintainable fix and matches the existing overflow-preview retention contract. The merge path still needs real Telegram proof rather than only mocked tests.

Security review:

Security review cleared: Security review cleared: the diff only changes Telegram stream retention logic and a focused test expectation, with no dependency, workflow, script, secret, or supply-chain surface changes.

What I checked:

Likely related people:

  • obviyus: Ayaan Zaidi authored the earlier Telegram preview cross-edit and draft-boundary commits that introduced and stabilized the generation/preview-stream behavior this PR touches. (role: feature-history owner; confidence: high; commits: 63b4c500d9ae, 575bd77196c3, 6edb512efaeb; files: src/telegram/draft-stream.ts, src/telegram/bot-message-dispatch.ts, extensions/telegram/src/draft-stream.ts)
  • steipete: Peter Steinberger has the largest shortlog count on the current and historical Telegram draft-stream/dispatch files and authored recent Telegram streaming/default/release-line work. (role: recent area contributor; confidence: medium; commits: fc1787fd4bea, e510042870cf, 3cf806d17215; files: src/telegram/draft-stream.ts, extensions/telegram/src/draft-stream.ts, extensions/telegram/src/bot-message-dispatch.ts)
  • Kevin Lin: Current-main blame for the affected extension lines points at the grafted 5fbaf2a8a2 commit, though feature history shows the Telegram behavior predates that broad commit. (role: current line-history contributor; confidence: low; commits: 5fbaf2a8a236; files: extensions/telegram/src/draft-stream.ts, extensions/telegram/src/bot-message-dispatch.ts)

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

@NianJiuZst
NianJiuZst marked this pull request as ready for review May 23, 2026 20:30
@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@martingarramon martingarramon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retain: true flag is set only on the generation-mismatch branch — the normal overflow-preview path is unchanged. The guard in bot-message-dispatch.ts (if (superseded.retain) { return; }) and the type declaration are already in place, so this is a targeted two-file change.

Two blockers before merge: the "Run agentic native Telegram proof" gate is failing (not a flake — all 70 unit/lint checks pass, only the live-proof gate fails). And #85808 touches the same file with a broader fix for the same symptom. Which approach is the intended one?

@steipete
steipete force-pushed the codex/issue-85807-telegram-preview-retain branch from 7ece580 to b09077e Compare May 23, 2026 23:47
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@steipete

Copy link
Copy Markdown
Contributor

Thanks @NianJiuZst. I recreated this on a maintainer branch in #85878 because this PR branch no longer allows maintainer updates, and the branch needed a fresh rebase on current main before it can go green.

The original commit/credit is preserved in the replacement PR. Closing this copy so review/CI happens in one place.

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. P1 High-priority user-facing bug, regression, or broken workflow. 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: XS 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 preview message deleted on generation mismatch race in sendMessageTransportPreview (missing retain:true)

3 participants