Skip to content

fix(telegram): retry abandoned messages instead of dropping them - #123528

Merged
obviyus merged 1 commit into
mainfrom
t3code/repro-poteto-mode-telegram-e2e
Aug 14, 2026
Merged

obviyus merged 1 commit into
mainfrom
t3code/repro-poteto-mode-telegram-e2e

Conversation

@obviyus

@obviyus obviyus commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #123519

What Problem This Solves

Fixes an issue where Telegram messages queued behind an active same-session run could disappear when the queued turn was abandoned. Durable ingress retried the update, but Telegram's in-process update tracker suppressed that retry and falsely completed the ingress row.

Reported by @hannesrudolph.

Why This Change Was Made

Queue abandonment now uses the existing retryable processing outcome at the producer. This keeps durable-ingress release, Telegram update tracking, and message-dispatch dedupe aligned without changing intentional terminal skips or adding a compatibility path. Production code delta: 1 line added, 1 removed.

User Impact

Telegram messages abandoned before turn adoption remain eligible for same-process durable retry. Once a retry is adopted, later Telegram redelivery remains deduplicated.

Evidence

  • Real-user Telegram repro on pre-fix 14882ac44dcd82bfa6fc145c5bcac73ceff036c4: queued marker OPENCLAW_E2E_ABANDONED_123519 received no reply; provider received zero requests containing that marker; Gateway logged both visible channel turn dispatched with no queued reply payloads and completed without a recorded processing outcome.
  • Regression red on pre-fix code: abandonment settled as skipped, failing the expected retryable owner outcome.
  • Regression green: defer -> abandon -> same-process retry -> adopt -> duplicate redelivery suppressed.
  • node scripts/run-vitest.mjs extensions/telegram/src/bot-message.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts — 170 passed.
  • Targeted Oxfmt, Oxlint, pnpm tsgo:extensions, pnpm check:test-types, and git diff --check — passed.
  • Final real-user Telegram proof on 0fc06d7a8206fac7443c0e952fb47d9ae1d40ae0: queued message 48661 received the SUT acknowledgement reaction, then /stop (48663) produced ⚙️ Agent was aborted. (48664). Gateway dispatched message 48661 twice (initial attempt plus same-process retry) and emitted zero completed without a recorded processing outcome diagnostics. The forced stop intentionally prevented model admission; the transport retry is the changed path under test.

@clawsweeper

clawsweeper Bot commented Aug 14, 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 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 5:28 AM ET / 09:28 UTC.

ClawSweeper review

What this changes

The branch classifies an unadopted deferred Telegram turn as retryable and adds regression coverage for same-process retry followed by post-adoption deduplication.

Regression provenance

Possible regression — probable (reproduction; reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for exact-head CI completion and maintainer merge review; the minimal producer-side result change repairs a verified Telegram message-loss path without a blocking correctness finding.

Priority: P1
Reviewed head: 61cd4abefe64fe96908c3cbfa768e1f992ba63f3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with real Telegram proof and regression coverage; only exact-head CI remains before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body supplies an after-fix real-user Telegram trace showing same-process retry and recovery; no private details should be added to further evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body supplies an after-fix real-user Telegram trace showing same-process retry and recovery; no private details should be added to further evidence.
Evidence reviewed 6 items Current-main failure path: An abandoned deferred turn is currently settled as skipped, even though the durable lifecycle is released for retry.
Tracker contract: Deferred failed-retryable results finish the tracker as incomplete; incomplete IDs are placed in failed state and can be accepted on the next replay.
Ingress owner behavior: The Telegram drain forwards a failed-retryable participant result to the durable lifecycle's failure path rather than tombstoning it as completed.
Findings None None.
Security None None.

How this fits together

Telegram updates are durably spooled before they enter the session queue. The Telegram update tracker decides whether a replay may re-enter dispatch, while the ingress drain turns the final processing result into retry or completion.

flowchart LR
  A[Telegram update] --> B[Durable ingress spool]
  B --> C[Deferred session turn]
  C --> D{Adopted or abandoned?}
  D -->|Adopted| E[Complete update tracking]
  D -->|Abandoned| F[Retryable processing result]
  F --> B
  E --> G[Duplicate redelivery suppressed]
Loading

Decision needed

Question Recommendation
Once exact-head CI completes, should this retryable classification for abandoned Telegram turns be merged? Merge after exact-head CI: Land the focused fix if the current head's required checks pass and remain clean.

Why: The patch changes the terminal delivery disposition for a durable ingress path, so maintainers should make the final merge call after the active exact-head checks settle.

Before merge

  • Resolve merge risk (P1) - This changes the retry-versus-completion outcome for Telegram delivery; exact-head CI is still running, so it should not land until the revised head is green.
Agent review details

Security

None.

PR surface

Source 0, Tests +64. Total +64 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 2 69 5 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 70 6 +64

Review metrics

Metric Value Why it matters
Production versus test LOC production +1/-1 (net 0); tests +69/-5 (net +64) The behavior repair is net-neutral production code, while the added test coverage exercises the full retry and dedupe boundary.

Merge-risk options

Maintainer options:

  1. Complete exact-head delivery validation (recommended)
    Wait for the running exact-head checks before merging because this changes whether an abandoned update retries or is treated as complete.

Technical review

Best possible solution:

Retain the producer-side retryable classification and merge only after exact-head CI confirms retry and post-adoption deduplication together.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main maps abandonment to skipped at the producer, while the tracker and ingress drain source establish the resulting retry-suppression path; the branch adds a focused same-process sequence.

Is this the best way to solve the issue?

Yes. Changing the producer's abandoned outcome to the existing retryable result is the narrow owner-boundary repair; modifying tracker dedupe instead would blur intentional completed and skipped cases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fc87337c1469.

Labels

Label justifications:

  • P1: Current behavior can silently lose a Telegram user message when a queued turn is abandoned before adoption.
  • merge-risk: 🚨 message-delivery: The patch changes the terminal result that determines whether a Telegram ingress update is retried or considered delivered.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body supplies an after-fix real-user Telegram trace showing same-process retry and recovery; no private details should be added to further evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies an after-fix real-user Telegram trace showing same-process retry and recovery; no private details should be added to further evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: The latest retrievable main-history touch for the processor, tracker, and bot-core paths is commit 1400049. (role: recent area contributor; confidence: medium; commits: 1400049ae9cf; files: extensions/telegram/src/bot-message.ts, extensions/telegram/src/bot-core.ts, extensions/telegram/src/bot-update-tracker.ts)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-14T06:41:01.037Z sha 0fc06d7a8206fac7443c0e952fb47d9ae1d40ae0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T06:46:45.714Z sha 0fc06d7a8206fac7443c0e952fb47d9ae1d40ae0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T08:19:26.510Z sha 1c45d32c60582cb1775cdf7e3c93a3ec7625f4c6 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 14, 2026
@obviyus
obviyus force-pushed the t3code/repro-poteto-mode-telegram-e2e branch from 0fc06d7 to 1c45d32 Compare August 14, 2026 08:13
@obviyus
obviyus enabled auto-merge (squash) August 14, 2026 08:14
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 14, 2026
@obviyus
obviyus force-pushed the t3code/repro-poteto-mode-telegram-e2e branch from 1c45d32 to 61cd4ab Compare August 14, 2026 09:22
@obviyus
obviyus disabled auto-merge August 14, 2026 10:49
@obviyus
obviyus force-pushed the t3code/repro-poteto-mode-telegram-e2e branch from 61cd4ab to 7d3e1f9 Compare August 14, 2026 10:49
@obviyus
obviyus enabled auto-merge (squash) August 14, 2026 10:50
@obviyus
obviyus merged commit 72a8b9b into main Aug 14, 2026
143 checks passed
@obviyus
obviyus deleted the t3code/repro-poteto-mode-telegram-e2e branch August 14, 2026 10:55
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 15, 2026
Treat pre-adoption Telegram turn abandonment as retryable so durable ingress releases the claim instead of tombstoning an unprocessed update.
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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

telegram: abandoned durable-ingress retry is deduped and falsely tombstoned completed

1 participant