Repository navigation
fix(telegram): delete business callback messages through their owning account - #128358
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 4:45 PM ET / 20:45 UTC. ClawSweeper reviewWhat this changesRoutes Telegram business callback-message deletion through the business API while preserving ordinary callback deletion. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessCurrent main still deletes business callbacks through the ordinary endpoint. The repair is in the existing callback-action owner and has no concrete code defect, but the Telegram policy’s real-behavior proof remains absent. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherTelegram callback handling maps button actions to edits, replies, and deletion requests. A business connection on the callback message determines which Telegram deletion endpoint is needed before any replacement message is sent. flowchart LR
A[Telegram callback] --> B[Callback action owner]
B --> C{Business connection present?}
C -->|Yes| D[Business deletion API]
C -->|No| E[Ordinary deletion API]
D --> F[Replacement or completion]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +96. Total +105 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep endpoint selection in the callback-action owner and attach a redacted real business-callback trace showing deletion before text replacement. Do we have a high-confidence way to reproduce the issue? Yes—current main’s callback action unconditionally reaches ordinary deletion for a message carrying business_connection_id; no live Telegram run was performed in this read-only review. Is this the best way to solve the issue? Yes—the existing callback action owner already owns the business connection for adjacent edits and replies, so endpoint selection there is the narrowest repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d97d350577ac. 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
|
|
Merged via squash.
|
…t test openclaw#128358 landed on main (after this branch's rebase point) with a new transport-payload.test.ts assertion hardcoding the old delete-then-send order for deleteAndReplyCallbackMessage's business-media-callback path. This branch's own earlier commit (f5758b3) had already reversed that order repo-wide (send-then-delete, to close a silent-failure window where a send failure after delete would leave neither picker nor confirmation) and added its own regression coverage in bot-handlers.callback-actions.test.ts. The rebase merged both changes, leaving one test asserting the pre-fix order. Update the assertion to the current send-then-delete order; no production code changes.
What Problem This Solves
Fixes an issue where users interacting with Telegram business-account message buttons could not delete the selected business message. When a photo or caption button needed to be replaced with text, the failed deletion was swallowed and the stale original message remained beside its replacement.
Why This Change Was Made
Telegram owns business-message deletion through a different Bot API endpoint than ordinary message deletion. The existing private callback-action owner already carries the authoritative business connection for edits and replies; this change uses the same owner to select
deleteBusinessMessages(business_connection_id, [message_id])for business callbacks while preservingdeleteMessage(chat_id, message_id)for ordinary callbacks. Both plugin-requested deletion and media-to-text callback replacement inherit the repair without changes to authorization, configuration, public APIs, or persistent state.Production delta: +4 lines. This is required by Telegram's separate business-only endpoint and message-ID-array contract; no generic deletion endpoint accepts the business connection.
User Impact
Telegram business-account buttons now correctly remove their message, and business photo/caption controls are cleaned up before a text replacement is sent. Ordinary Telegram message deletion remains unchanged.
Evidence
5d1ae433b02973fa009bdc2093a7a630e74a20f5.deleteMessagewith{ chat_id, message_id }; business deletion emitsdeleteBusinessMessageswith{ business_connection_id, message_ids: [message_id] }; media replacement deletes the business message before sending the replacement.extensions/acpxdiagnostics; current main has byte-identical affected files, and no changed Telegram file has a type error.