Skip to content

fix(telegram): delete business callback messages through their owning account - #128358

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-telegram-business-delete-20260823
Aug 23, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-telegram-business-delete-20260823

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 preserving deleteMessage(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

  • Exact reviewed head: 5d1ae433b02973fa009bdc2093a7a630e74a20f5.
  • Authentic pre-fix RED: three checked-in regressions failed at the real plugin callback boundary, actual grammY Bot API request boundary, and media replacement lifecycle; the ordinary deletion regression passed.
  • Post-fix owner proof: 323 tests passed across six complete Telegram callback, business-message, question, native-command, interactive-fallback, and transport suites.
  • Separate independent review: 300 tests passed across four complete owner and sibling suites; no actionable findings.
  • Fresh authenticated full committed-branch code review: clean.
  • Real grammY request proof: ordinary deletion emits deleteMessage with { chat_id, message_id }; business deletion emits deleteBusinessMessages with { business_connection_id, message_ids: [message_id] }; media replacement deletes the business message before sending the replacement.
  • Targeted type-aware lint, formatting, max-lines ratchet, assertion ratchet, dependency guards, plugin boundary, dead-export scan, and doctor contract tests passed.
  • Existing unrelated shared-dependency type mismatch: broad extension typecheck reports only unchanged extensions/acpx diagnostics; current main has byte-identical affected files, and no changed Telegram file has a type error.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S maintainer Maintainer-authored PR labels Aug 23, 2026
@steipete
steipete marked this pull request as ready for review August 23, 2026 20:39
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 4:45 PM ET / 20:45 UTC.

ClawSweeper review

What this changes

Routes Telegram business callback-message deletion through the business API while preserving ordinary callback deletion.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Current 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
Reviewed head: 5d1ae433b02973fa009bdc2093a7a630e74a20f5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Current-main defect: Current main unconditionally calls the ordinary deletion API for callback messages, including messages that already carry business metadata for adjacent actions.
Owner-boundary repair: The PR selects the business deletion API only from the callback-owned business connection and leaves ordinary deletion unchanged.
Caller and sibling coverage: The same action is exposed to plugin callbacks and is used by the media-to-text replacement fallback; both paths receive the repair without new public API surface.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/telegram/src/transport-payload.test.ts

Result: FAIL (partial) — step 2 expect_output deletes business callbacks through their owning Bot API endpoint: expected terminal output was not visible within 30 seconds: "deletes business callbacks through their owning Bot API endpoint"

node scripts/run-vitest.mjs extensions/telegram/src/transport-payload.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128358-n4fs5O/target$ node scripts/run-vitest.mjs extensions/telegram/src/transport-payload.test.ts
node scripts/run-vitest.mjs extensions/telegram/src/transport-payload.test.ts
[test] starting test/vitest/vitest.extension-telegram.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128358-n4fs5O/target

 ✓  extension-telegram  extensions/telegram/src/transport-payload.test.ts (9 tests) 1380ms
     ✓ serializes a channel Direct Messages document through real multipart transport  994ms

 Test Files  1 passed (1)
      Tests  9 passed (9)
   Start at  20:46:10
   Duration  22.74s (transform 17.93s, setup 881ms, import 20.36s, tests 1.38s, environment 0ms)

[test] passed 1 Vitest shard in 27.65s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128358-n4fs5O/target$ node scripts/run-vitest.mjs extensions/telegram/src/transport-payload.test.ts
[test] starting test/vitest/vitest.extension-telegram.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128358-n4fs5O/target































Assertions:

  • FAIL expect_output: deletes business callbacks through their owning Bot API endpoint

How this fits together

Telegram 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
Loading

Before merge

  • Resolve merge risk (P1) - Telegram callback policy requires real Telegram behavior proof; the PR body describes test output but includes no redacted business-callback trace.
  • Resolve merge risk (P1) - The installed grammY 1.45.1 method contract could not be directly inspected in this checkout, so a live trace should confirm the endpoint and payload before merge.
  • Complete next step (P2) - This maintainer-authored protected PR needs real Telegram proof and dependency-contract confirmation, not an automated repair branch.
Agent review details

Security

None.

PR surface

Source +9, Tests +96. Total +105 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 10 1 +9
Tests 2 96 0 +96
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 106 1 +105

Review metrics

Metric Value Why it matters
Production vs test delta production +4, tests +101 The necessary endpoint-selection branch is small and is covered by owner-boundary and request-payload regressions.

Merge-risk options

Maintainer options:

  1. Add business-callback proof before merge (recommended)
    Attach a redacted real Telegram business callback trace showing the original message is removed and any replacement is sent afterward.
  2. Accept request-boundary-only evidence
    Maintain the current grammY request tests as the sole evidence, accepting that no real business-account behavior was demonstrated.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This is a bounded Telegram callback-deletion repair with limited blast radius.
  • add merge-risk: 🚨 message-delivery: If the business endpoint or payload differs in live Telegram behavior, the original callback message can remain beside its replacement.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P2: This is a bounded Telegram callback-deletion repair with limited blast radius.
  • merge-risk: 🚨 message-delivery: If the business endpoint or payload differs in live Telegram behavior, the original callback message can remain beside its replacement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame and feature history identify this person as the author of the callback action owner and the proposed repair. (role: introduced callback action owner and recent Telegram contributor; confidence: high; commits: 5355a7ad855d, 5d1ae433b029; files: extensions/telegram/src/bot-handlers.callback-actions.ts, extensions/telegram/src/bot-handlers.callback-router-controls.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Tighten the PR description with what changed, how it was validated, and any remaining risk.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 629e007 into main Aug 23, 2026
203 checks passed
@steipete
steipete deleted the codex/autoqa-telegram-business-delete-20260823 branch August 23, 2026 21:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

a-yeyang pushed a commit to a-yeyang/openclaw that referenced this pull request Aug 24, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant