Repository navigation
fix(telegram): preserve exact whitespace in selected reply quotes - #129254
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 7:50 AM ET / 11:50 UTC. ClawSweeper reviewWhat this changesPreserves leading and trailing whitespace in Telegram selected-reply quotes for direct actions and durable channel payloads. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open: current main still trims selected Telegram quote text in both ingress paths, while this focused PR preserves it and the prior proof blocker is now satisfied by real Telegram evidence. The PR is maintainer-authored/labeled, so it should remain for normal maintainer merge handling. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherTelegram message actions convert model or channel payload parameters into Bot API send requests. Quote text must reach the sender unchanged so Telegram can match the intended source substring. flowchart LR
A[Message action] --> B[Telegram action ingress]
B --> C[Quote text preparation]
C --> D[Telegram sender]
D --> E[Telegram Bot API]
E --> F[Selected reply in chat]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +16. Total +16 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the net-neutral ingress repair after exact-head merge/check verification, retaining the sender’s existing whitespace-only quote rejection. Do we have a high-confidence way to reproduce the issue? Yes: the attached real Telegram baseline and candidate run exercises both ingress paths with a whitespace-padded repeated substring and records the sent quote bytes. Is this the best way to solve the issue? Yes: disabling trimming at the two ingress owners while retaining the sender’s whitespace-only rejection fixes the root cause without adding a parallel path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1fdd10bf6aa5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Mantis Telegram proof — PASSSummary: A real Telegram user sent a message containing two occurrences of 'selected passage', with the intended second occurrence surrounded by two leading and trailing spaces. Mocked model tool calls then sent selected-quote replies through both the direct Telegram action path and the durable rich-presentation payload path. Current main silently trimmed the requested quote to 'selected passage' in both paths. The candidate preserved ' selected passage ' byte-for-byte in both Bot API requests. Telegram accepted every request with HTTP 200 and Telegram Desktop displayed each reply against the intended source message.
Motion-trimmed clips: |
|
Merged via squash.
|


What Problem This Solves
Fixes an issue where Telegram selected replies could quote the wrong passage or fail to send when the selected text began or ended with spaces, tabs, or newlines.
Why This Change Was Made
Telegram requires a quote to be an exact substring of the original message, but both OpenClaw action-ingress owners trimmed it before the existing Telegram sender received the value. Preserve the exact quote bytes through both direct actions and durable channel payloads while retaining the sender's existing whitespace-only rejection.
Production delta: 2 additions / 2 deletions (net 0). No configuration, protocol, authentication, persistence, plugin-SDK, or dependency changes.
User Impact
Telegram reply quotes now match the text the user or agent actually selected, including meaningful leading/trailing whitespace and newlines, for both standard and snake-case action parameters.
Evidence
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/telegram/src/action-runtime.test.ts extensions/telegram/src/channel-actions.contract.test.ts extensions/telegram/src/reply-parameters.test.ts --reporter=dot— 149 passed.