fix(telegram): start partial draft previews immediately#79696
fix(telegram): start partial draft previews immediately#79696TurboTheTurtle wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source inspection gives a high-confidence reproduction path: docs require Telegram partial preview send/edit behavior, current main passes a 30-character initial threshold to partial mode, and the draft stream drops short initial updates below that threshold. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow Telegram plugin fix after live Telegram DM proof or equivalent redacted runtime logs show a short partial creates and then edits the preview while block-mode debounce remains covered. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: docs require Telegram partial preview send/edit behavior, current main passes a 30-character initial threshold to partial mode, and the draft stream drops short initial updates below that threshold. Is this the best way to solve the issue? Yes for the code direction: limiting the 30-character debounce to Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d2ac6c3dd5d5. |
fdc8eed to
977c2fd
Compare
|
Updated this PR after the failed checks:
Also passed: One limitation: I still do not have a live Telegram bot DM screenshot/recording from this environment, so the proof is local runtime validation of the real dispatcher/draft-stream path rather than live production traffic. @clawsweeper re-review |
|
Thanks for the focused repro and test. We’re going to close this one because the patch removes Telegram’s 30-character first-preview debounce in partial mode, which is intentional push-notification UX. #79605 should stay open for a fix that restores preview streaming while preserving that debounce. |
Resubmission of #79682 after it was auto-closed by the active-PR limit. Supersedes the older draft #79664.
Summary
Fixes #79605.
Telegram partial preview mode now starts the draft preview immediately instead of applying the block-streaming first-message debounce. That preserves the debounce for block previews, while allowing direct model partial text to create the live Telegram preview before final delivery.
The regression test uses the real Telegram draft stream transport from the dispatcher test, emits a short direct partial (
Hi), verifies the draft transport sends the preview before final delivery, then verifies the final answer edits that preview instead of falling back to the normal final-send path.Root Cause
dispatchTelegramMessagepassedDRAFT_MIN_INITIAL_CHARSto the draft stream for bothpartialandblockmodes. Short direct model partials inpartialmode could stay below the 30-character initial threshold, so no visible Telegram preview was created even though partial callbacks reached the lane.Real behavior proof
Behavior or issue addressed: Telegram partial streaming should create the draft preview on the first short model partial instead of waiting for the 30-character block-mode debounce threshold.
Real environment tested: Local OpenClaw source checkout on macOS with Node/pnpm, exercising the Telegram dispatcher and draft stream transport paths in
extensions/telegram/src/bot-message-dispatch.test.tsandextensions/telegram/src/draft-stream.test.ts.Exact steps or command run after this patch:
pnpm test extensions/telegram/src/bot-message-dispatch.test.ts extensions/telegram/src/draft-stream.test.ts src/plugin-sdk/channel-streaming.test.tsEvidence after fix: Copied terminal output from the focused Telegram streaming validation:
Observed result after fix: A direct model partial
HireachesreplyOptions.onPartialReply, the Telegram draft transport sends the preview message before final delivery, the final answerHi thereedits that preview, and the normal finaldeliverRepliespath is not used for that turn.What was not tested: A live Telegram DM screenshot or recording from a real bot account was not captured in this environment; the proof covers the OpenClaw Telegram dispatcher/draft-stream runtime path locally.
Validation
pnpm test extensions/telegram/src/bot-message-dispatch.test.ts extensions/telegram/src/draft-stream.test.ts src/plugin-sdk/channel-streaming.test.tspnpm exec oxfmt --check --threads=1 extensions/telegram/src/bot-message-dispatch.ts extensions/telegram/src/bot-message-dispatch.test.tsgit diff --check FETCH_HEAD