fix(telegram): dedupe replayed message dispatches#85208
Conversation
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. for source-level reproduction: current main has only update-level Telegram dedupe before dispatch, and the linked beta-blocker identifies the replay path where the same Telegram chat/message identity can dispatch again under a new update delivery. I did not rerun live Telegram proof in this read-only review, but the PR body reports a live before/after Crabbox replay proof. PR rating Rank-up moves:
What the crustacean ranks mean
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the Telegram-owned durable dispatch guard after maintainer review confirms the persistence, release, and TTL semantics for replay recovery. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main has only update-level Telegram dedupe before dispatch, and the linked beta-blocker identifies the replay path where the same Telegram chat/message identity can dispatch again under a new update delivery. I did not rerun live Telegram proof in this read-only review, but the PR body reports a live before/after Crabbox replay proof. Is this the best way to solve the issue? Yes, subject to maintainer approval: a Telegram-owned persistent claimable guard committed at dispatch start is the narrow maintainable fix for this replay bug. The latest head appears to address the earlier post-dispatch commit finding with a dispatch-start hook and pending-dispatch regression coverage. Label changes:
Label justifications:
Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 55cfe00a3a40. |
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Frosted Clawlet Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
* Fix Telegram dispatch replay dedupe * Add changelog for Telegram dispatch dedupe * Persist Telegram replay dedupe at dispatch start
Summary
update_id, bypassing update-level dedupe and dispatching the message again.chat.id + message_id, committed only after the message reaches the real dispatch boundary.Motivation
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof
Behavior addressed: A replayed Telegram update for the same logical
chat.id/message_idshould not dispatch the message to the model a second time.Real environment tested: AWS Crabbox, provider
aws, runrun_8d15e6bb87de, leasecbx_33900860a05e, live Telegramtelegramcredential from Convex, isolated Telegram ingress spool, blocking mock OpenAI-compatible backend.Exact steps or command run after this patch: Built the patched checkout on AWS Crabbox, leased a Convex
telegramcredential, started OpenClaw gateway with Telegram isolated ingress and a blocking mock OpenAI backend, sent one real Telegram group message to the SUT bot, waited until the first model request reached the backend and stayed pending, crash-restarted the gateway against the same state directory, wrote the same Telegram message object back into the isolated ingress spool with a new syntheticupdate_id, then checked dispatch dedupe logs and mock model request count.Evidence after fix:
{ "status": "pass", "proofId": "84886-pending-mpgg7ika", "groupId": "-5140433623", "requestMessageId": 11701, "replayUpdateId": 1779425915916, "requestsAtFirstDispatch": 1, "requestsAfterRestartReplay": 1, "firstRequestConnectionClosed": true, "skipLogSeen": true }Observed result after fix: The original live Telegram message reached the model dispatch boundary once and was still pending when the gateway was killed. After restart, the replayed spool update logged the dispatch-dedupe skip and did not create a second mock model request.
What was not tested: A visible second Telegram reply was not required as the pass condition; the proof targeted the dispatch boundary directly by counting model requests.
Before evidence: On current main, the same replay shape was observed to reach the dispatch boundary twice for the same Telegram
chat.id/message_idunder different update deliveries.Root Cause
update_idwhen available, butupdate_idis a delivery cursor rather than stable message identity. Replays of the same logical Telegram message can arrive with different update IDs.chat.id/message_id.Regression Test Plan
extensions/telegram/src/message-dispatch-dedupe.test.tsextensions/telegram/src/bot.create-telegram-bot.test.tssrc/auto-reply/inbound.test.tsUser-visible / Behavior Changes
Replayed Telegram messages with the same
chat.id/message_idno longer trigger duplicate model dispatches/replies within the dispatch dedupe TTL.Diagram
Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
/v1/responsestelegrampoolSteps
update_id.Expected
chat.id/message_idis skipped before a second model dispatch after restart.Actual
Evidence
Human Verification (required)
pnpm check:changed.$autoreviewuntil clean.Review Conversations
Compatibility / Migration
Risks and Mitigations