Repository navigation
fix(telegram): history claims rejected voice attachments were delivered - #130399
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Merged via squash.
|
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:53 PM ET / 20:53 UTC. ClawSweeper reviewWhat this changesThe PR records only Telegram attachments accepted by the platform so mirrored conversation history reflects delivered fallback text and accepted mixed media. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-authored PR open: the patch fixes the current-main transcript defect at the delivery owner, with no blocking correctness finding. Exact-head CI is still running and a live mirror assertion would further reduce risk. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTelegram reply delivery sends media and fallback text through the Bot API, then mirrors the result into OpenClaw conversation history. The mirror should represent what recipients actually received, not requested media that Telegram rejected. flowchart LR
A[Agent reply] --> B[Telegram delivery]
B --> C{Media accepted?}
C -->|Yes| D[Accepted media list]
C -->|No| E[Fallback text]
D --> F[Transcript mirror]
E --> F
F --> G[Conversation history]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +36. Total +40 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the delivery-boundary accepted-media record once exact-head CI is green; retain the media-first formatter unchanged because it correctly formats the accepted attachment set. Do we have a high-confidence way to reproduce the issue? Yes, from source: make sendVoice reject with VOICE_MESSAGES_FORBIDDEN while sendMessage succeeds, then inspect the transcript-mirror payload; current main includes the rejected URL and the candidate’s focused tests cover that path. Is this the best way to solve the issue? Yes: the formatter correctly prefers delivered media, so recording the accepted-media fact where Telegram delivery succeeds is the narrowest maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against df559c3284c9. LabelsLabel changes:
Label 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
|
Closes #130398
What Problem This Solves
Fixes an issue where users receiving a text alternative after Telegram rejects an automatically generated final voice message would see the rejected audio filename in the conversation history instead of the text that was delivered. The affected final-reply mirror also incorrectly includes rejected attachments in mixed-media payloads.
Why This Change Was Made
Record accepted media at the Telegram delivery boundary and pass that fact to the existing transcript mirror. Keep the existing media-first history representation, partial-failure handling, storage, and durable-send behavior unchanged. Remove redundant first-item and pending-follow-up bookkeeping within the same media owner.
Production LOC: +18/-14 (net +4). The added state distinguishes media actually accepted by Telegram from a successful text alternative; tests are +40/-4.
User Impact
When a voice message cannot be delivered but its text alternative succeeds, the conversation history now retains that text. Mixed replies retain accepted attachments without claiming rejected ones were sent. Ordinary media and captionless-media recovery keep their existing behavior.
Evidence
VOICE_MESSAGES_FORBIDDEN, and delivered the text alternative. The actual Gatewaychat.historyresponse contains achannel-finaldelivery-mirror entry with the delivered text and no rejected audio filename. Independent source-blind validation passed all five cases below. This is mock-provider Gateway proof, not live Telegram.MEDIA:directives are delivered as blocks and do not activate this final-reply mirror. Mixed-media combinations are covered at the delivery-owner boundary, not claimed as the automatic-speech Gateway flow.Hosted CI run 33012032715 passed on
803821394a15270d157c40bf97fb94012264cf64, including the required CI gate.Independent source-blind operator evidence (fresh synthetic chats, real Gateway API; sequential completion observed in Gateway diagnostics):
The validator inspected all 11 Telegram send attempts and exactly four matching
channel-finalhistory entries. Total failure produced the explicit diagnosticfinal reply failed: GrammyError: Call to 'sendMessage' failed! (400: Bad Request: text must be non-empty); the synthetic endpoint deliberately rejected nonempty text, so this proves failure handling, not Telegram's real validation rules. Final refreshed history still contained no success record for that failed case.{"kind":"mock-provider-gateway","verdict":"pass","head":"803821394a15270d157c40bf97fb94012264cf64","flow":"automatic final-only TTS with native quote","cases":5,"telegramSendAttempts":11,"channelFinalMirrors":4,"falseSuccessMirrors":0,"sourceBlind":true,"liveTelegram":false}AI-assisted. No configuration, public SDK, authentication, protocol, schema, or migration changes.