Skip to content

fix(channels): retry abandoned deliveries without penalizing Telegram restarts - #130077

Merged
steipete merged 2 commits into
mainfrom
codex/fix-channel-ingress-abandon-retry-20260826
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-channel-ingress-abandon-retry-20260826

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #122864, #129974

What Problem This Solves

Fixes an issue where channel users could lose reliable delivery retries or repeatedly reprocess the same failed inbound message after a delivery stopped before adoption. The regression in #122864 changed the shared abandonment lifecycle used by all 18 channel owners while solving a Telegram-specific shutdown problem. It also broke unrelated pull requests in hosted CI, including the Microsoft Teams extension shards for #129974.

Why This Change Was Made

Restore the shared ingress owner's original retry-accounted abandonment contract so genuine failed pre-adoption delivery increments its attempt count, records the attempt time, and respects backoff. Route only Telegram owner shutdown through the existing cancellation callback, which preserves any previous attempts, timestamps, and errors without consuming retry budget. Telegram dispatch-dedupe rollback failures still use the existing terminal failure callback.

This reuses existing lifecycle boundaries and reduces production code by two lines; it does not change public Plugin SDK contracts, SQLite schemas, persisted data formats, security policy, or channel ownership.

User Impact

Inbound delivery failures across supported channels retry with their intended durable accounting, backoff, restart, and threshold behavior again. Telegram sessions can restart without falsely spending retry attempts or replacing a previous delivery error.

Evidence

  • On unchanged current main, the existing Microsoft Teams real-SQLite lifecycle integration failed exactly as hosted CI: message-handler.ingress-lifecycle.test.ts:208 expected pending attempt 1 with a retry timestamp and instead found no pending row. The unchanged test now passes, including durable backoff, restart, and retry-threshold scenarios.
  • Three restored shared-owner regressions failed before the production fix with attempts 0 instead of 1, 1, and 3; all pass afterward.
  • Telegram owner-abort coverage now verifies both never-attempted cancellation and preservation of an actual persisted previous attempt, timestamp, and delivery error; fatal dispatch-dedupe rollback remains on the existing failure path.
  • Owner-focused verification: 135 passing checks across Telegram, Microsoft Teams, Discord, Feishu, Slack, and the shared ingress owner/monitor.
  • Separate independent verification: 110 passing checks across nine files and seven configuration shards, including the Plugin SDK, unchanged Microsoft Teams real-SQLite restart/backoff integration, Discord cancellation, Feishu retry ownership, Slack, and core abandonment/cancellation/debounce.
  • Four changed files, production delta -2 lines; formatting and whitespace checks pass. Two independent owner-boundary reviews and the authenticated full-commit review found no actionable issues.

@clawsweeper

clawsweeper Bot commented Aug 26, 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: XS maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 10:51
@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: 🐚 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 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:41 AM ET / 11:41 UTC.

ClawSweeper review

What this changes

This PR makes abandoned shared channel deliveries consume retry accounting again while routing Telegram owner shutdown through cancellation that preserves existing retry facts.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer review: the exact head restores the shared retry-accounting invariant and keeps Telegram restart cancellation separate; no blocking defect was found.

Priority: P1
Reviewed head: 2e17b85b62e1d03ea1b1a0727fd1f25655b718af

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, owner-boundary aligned, and backed by targeted shared and Telegram regression coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored reliability repair is assessed through its durable queue and restart-regression coverage; no external-contributor proof action is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored reliability repair is assessed through its durable queue and restart-regression coverage; no external-contributor proof action is required.
Evidence reviewed 6 items Current-main defect: Current main explicitly releases an abandoned claim with recordAttempt false, so an abandoned delivery does not update durable retry accounting.
Exact-head repair: The PR removes the retry-suppressing option from abandonment while retaining it only for the explicit cancellation callback.
Telegram boundary coverage: The added Telegram scenario first creates a genuine prior failure, then verifies shutdown preserves its attempt count, timestamp, and error rather than consuming another attempt.
Findings None None.
Security None None.

Live Verification

Command: pnpm exec vitest run src/channels/message/ingress-drain.test.ts src/channels/message/ingress-drain.cancellation.test.ts extensions/telegram/src/telegram-ingress-drain.test.ts

Result: FAIL (failed) — execution before step 1 run: terminal command did not produce output or exit within 30 seconds: "pnpm exec vitest run src/channels/message/ingress-drain.test.ts src/channels/message/ingress-drain.cancellation.test.ts extensions/telegram/src/telegram-ingress-drain.test.ts"

terminal command did not produce output or exit within 30 seconds: "pnpm exec vitest run src/channels/message/ingress-drain.test.ts src/channels/message/ingress-drain.cancellation.test.ts extensions/telegram/src/telegram-ingress-drain.test.ts"

Captured output:



















































Assertions:

  • FAIL expect_output: Test Files

How this fits together

Inbound channel events enter a durable queue and the shared ingress drain either completes, retries, or cancels each claimed event. Telegram’s monitor supplies transport-specific deferred-work outcomes to that shared lifecycle.

flowchart LR
  A[Inbound channel event] --> B[Durable ingress queue]
  B --> C[Shared ingress drain]
  C --> D{Pre-adoption outcome}
  D -->|Abandoned delivery| E[Record retry attempt and backoff]
  D -->|Telegram shutdown| F[Cancel without retry cost]
  E --> G[Future delivery retry]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - This shared lifecycle change affects every channel that passes reply-lane abandonment through the core drain, so exact-head channel CI should complete before merge.
  • Complete next step (P2) - No mechanical repair remains; wait for the exact-head channel validation required for this shared message-delivery change.
Agent review details

Security

None.

PR surface

Source -2, Tests +11. Total +9 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 8 -2
Tests 2 21 10 +11
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 27 18 +9

Review metrics

Metric Value Why it matters
Production versus test delta production +6/-8 (net -2); tests +21/-10 (net +11) The bug repair is net-negative in production while adding focused shared-owner and Telegram restart regression coverage.

Merge-risk options

Maintainer options:

  1. Complete exact-head lifecycle validation (recommended)
    Merge after the queued channel suites confirm retry accounting for ordinary abandonment and retry-neutral Telegram shutdown.

Technical review

Best possible solution:

Land the canonical split: shared abandonment records retry state, while Telegram restart shutdown invokes cancellation and preserves durable retry facts.

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

Yes—source establishes the current-main path: abandonment passes recordAttempt false to the durable release; the focused regressions model both shared abandonment and Telegram shutdown.

Is this the best way to solve the issue?

Yes—the repair restores the generic owner behavior and uses the existing cancellation callback only for Telegram’s distinct shutdown case, avoiding a Telegram-specific exception in shared code.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The PR repairs durable inbound delivery retry behavior shared by channel owners.
  • merge-risk: 🚨 message-delivery: A lifecycle error here can change whether inbound events retry, back off, or are reprocessed.
  • 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: This maintainer-authored reliability repair is assessed through its durable queue and restart-regression coverage; no external-contributor proof action is required.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the shared durable monitor refactor and the gateway-draining lifecycle repair, and owns the current repair head. (role: shared-ingress refactor and recent lifecycle contributor; confidence: high; commits: ee0e3a4d478e, 1958551ff924, 2e17b85b62e1; files: src/channels/message/ingress-drain.ts, extensions/telegram/src/telegram-ingress-drain.ts)
  • jchoi-atn: The merged Telegram repair introduced the current-main abandonment option identified by blame. (role: merged Telegram ingress contributor; confidence: high; commits: 880a2a62994c; files: src/channels/message/ingress-drain.ts, extensions/telegram/src/telegram-ingress-drain.ts)
  • xingzhou: Authored the recent shared timed-out-ingress retry repair in the same owner module. (role: adjacent retry-policy contributor; confidence: medium; commits: ee79b0a49ae4; files: src/channels/message/ingress-drain.ts)

Rank-up moves

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

  • Let the exact-head channel checks complete before merge.

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 (1 earlier review cycle)
  • reviewed 2026-08-26T11:01:16.187Z sha 1b542ff :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 4151625 into main Aug 26, 2026
200 checks passed
@steipete
steipete deleted the codex/fix-channel-ingress-abandon-retry-20260826 branch August 26, 2026 12:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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