Repository navigation
fix(telegram): linkPreview:false is ignored on streamed replies - #114125
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 4:45 AM ET / 08:45 UTC. ClawSweeper reviewWhat this changesThe branch forwards Telegram's existing Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep this PR open: it is a focused, API-aligned fix for the linked current bug, but the required after-fix real Telegram proof is still absent. Likely related people: steipete is the best routing candidate (medium confidence) from the active branch update, assignment, and the merged Telegram-proof harness work. Priority: P2 Review scores
Verification
How this fits togetherTelegram answer streaming keeps one visible reply message by first sending it and then editing it as tokens arrive. This path receives the resolved Telegram channel configuration and calls the Bot API, so it must preserve the same link-preview preference as ordinary outbound messages. flowchart LR
A[Telegram channel config] --> B[Draft reply controller]
B --> C[Streaming draft builder]
C --> D{Rich or plain transport}
D --> E[Initial Telegram send]
D --> F[Later message edits]
E --> G[Visible streamed reply]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +34, Tests +69. Total +103 across 3 files. View PR surface stats
Review metricsNone. Mantis proof suggestionA Telegram Desktop before/after capture can directly prove the user-visible initial-send and follow-up-edit behavior that tests alone cannot show. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main's streamed draft path omits the resolved Is this the best way to solve the issue? Yes, conditionally: forwarding the existing setting into the one missing streaming path and using Telegram's documented send/edit option is narrower and more maintainable than adding a new preference or fallback. A live Telegram result is still needed to confirm the client-visible outcome. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ac6009eab195. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
58f925b to
2a85b9b
Compare
Replies delivered through draft streaming still unfurled the first URL
even with channels.telegram.linkPreview: false. Non-streamed sends
already honored the flag.
createTelegramDraftStream never received linkPreview and never set
link_preview_options, on either its initial sendMessage or its
editMessageText calls. Finalization could not clean it up: it skips the
final edit when the streamed draft text already equals the final text,
which is the common case, so the draft message stays as-is with the
preview attached.
Passes linkPreview from telegramCfg into the draft stream and applies
link_preview_options: { is_disabled: true } on the send and on every
edit, since an edit that omits the field re-enables the preview
server-side. Rich messages keep expressing this as skip_entity_detection
at render time, which already worked.
Call arity is preserved when no preview options apply, so existing edit
assertions are unaffected.
Closes openclaw#111525
Co-Authored-By: Claude Opus 5 <[email protected]>
Co-authored-by: Zakaria Rahali <[email protected]>
2a85b9b to
0c2c6ba
Compare
|
On the outstanding real behavior proof item: I don't have a live Telegram bot setup, so I can't produce a redacted after-fix capture of a streamed URL reply myself. The @steipete since you're assigned and already pushed the parity test commit — would you be able to trigger the native Telegram proof run? Happy to fold the resulting artifact into the PR body and re-request review afterwards. For what it's worth on the transport contract: the fix carries |
|
Merged via squash.
|
* origin/main: fix(codex): restore connected apps for token-authenticated runs (openclaw#115075) fix(codex): classify hosted search timeouts (openclaw#115837) fix(msteams): keep attachment replies in channel threads (openclaw#94348) fix(telegram): linkPreview:false is ignored on streamed replies (openclaw#114125) fix(protocol): make Swift model checks non-mutating (openclaw#115793) fix(searxng): avoid duplicating search endpoint (openclaw#113661) fix(agents): preserve tool-result middleware identity (openclaw#115821) refactor(meetings): consolidate runtime facades (openclaw#115819)
…claw#114125) * fix(telegram): linkPreview:false is ignored on streamed replies Replies delivered through draft streaming still unfurled the first URL even with channels.telegram.linkPreview: false. Non-streamed sends already honored the flag. createTelegramDraftStream never received linkPreview and never set link_preview_options, on either its initial sendMessage or its editMessageText calls. Finalization could not clean it up: it skips the final edit when the streamed draft text already equals the final text, which is the common case, so the draft message stays as-is with the preview attached. Passes linkPreview from telegramCfg into the draft stream and applies link_preview_options: { is_disabled: true } on the send and on every edit, since an edit that omits the field re-enables the preview server-side. Rich messages keep expressing this as skip_entity_detection at render time, which already worked. Call arity is preserved when no preview options apply, so existing edit assertions are unaffected. Closes openclaw#111525 Co-Authored-By: Claude Opus 5 <[email protected]> * test(telegram): cover streamed reply option parity Co-authored-by: Zakaria Rahali <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* origin/main: fix(codex): restore connected apps for token-authenticated runs (openclaw#115075) fix(codex): classify hosted search timeouts (openclaw#115837) fix(msteams): keep attachment replies in channel threads (openclaw#94348) fix(telegram): linkPreview:false is ignored on streamed replies (openclaw#114125) fix(protocol): make Swift model checks non-mutating (openclaw#115793) fix(searxng): avoid duplicating search endpoint (openclaw#113661) fix(agents): preserve tool-result middleware identity (openclaw#115821) refactor(meetings): consolidate runtime facades (openclaw#115819)
Closes #111525
What Problem This Solves
Fixes an issue where users running Telegram with
channels.telegram.linkPreview: falsewould still get link-preview cards on streamed replies. Any answer containing a URL unfurls it, so the setting silently does not hold for the delivery path most users actually see.Non-streamed sends (the
messagetool, the CLI send path) already honor the flag, which makes the inconsistency hard to diagnose: the same config visibly works on one path and not the other.Why This Change Was Made
createTelegramDraftStreamwas never givenlinkPreviewat its creation site increateDraftLane, and never setlink_preview_optionson either its initialsendMessageor any of itseditMessageTextcalls.Finalization does not rescue it.
editStreamMessagedoes passlinkPreview, but finalization deliberately skips that edit when the streamed draft text already equals the final text — which is the common case, since the draft is the final message. So the preview survives.Two details drove the shape of the fix:
editMessageTextthat omitslink_preview_options, so setting it once on the first send is not enough.skip_entity_detectionat render time (bot-message-dispatch-draft.ts:111), matching howdelivery.send.tssplits the two transports. This PR deliberately leaves that path alone and only fixes the HTML/plain transports, plus the plain fallbacks the rich path drops to on error.Edit calls go through a small helper that preserves call arity when no preview options apply — appending an explicit
undefinedwould have changed existing three-argumenteditMessageTextassertions without changing behavior.User Impact
channels.telegram.linkPreview: falsenow suppresses link previews on streamed replies, matching the non-streamed send path and the documented meaning of the setting. Users who set it stop seeing unfurled cards on the streaming path. Behavior is unchanged whenlinkPreviewis unset ortrue: nolink_preview_optionsfield is sent at all.Evidence
Three tests added to
extensions/telegram/src/draft-stream.test.ts: preview disabled on send and on the follow-up edit,parse_modepreserved alongside it on the HTML transport, and a guard that the field stays absent by default.Before (fix neutralized, tests present) — the two behavior tests fail, and the default-path guard correctly still passes:
After (fix applied):
No regressions in the dispatch paths that build the draft lane:
I do not have a live Telegram bot to record the unfurl itself, so the proof here is the transport-level assertion that
link_preview_options: { is_disabled: true }now rides on both the send and the edit — which is the exact API contract the issue identifies as missing. The issue reporter states they are carrying a local patch doing the same thing and offered to test a fix.