fix(telegram): topic replies stall after session conflicts#96550
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 4:16 PM ET / 20:16 UTC. Summary PR surface: Source +123, Tests +235. Total +358 across 10 files. Reproducibility: yes. at source level: current main still releases retryable Telegram spooled failures without conflict-specific backoff, and #96837 documents the SQLite pending retry loop. I did not run a live Telegram reproduction in this read-only review. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Rebase and narrow this PR against current main, keep the Telegram conflict backoff if maintainers want it as the follow-up to the merged writer-lane fix, and add redacted current-head Telegram topic or DM proof before merge. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main still releases retryable Telegram spooled failures without conflict-specific backoff, and #96837 documents the SQLite pending retry loop. I did not run a live Telegram reproduction in this read-only review. Is this the best way to solve the issue? Unclear as submitted: the remaining Telegram backoff is a plausible follow-up, but the branch should be rebased and narrowed after #96847 merged. It also needs current-head Telegram proof before the solution is merge-ready. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d2da8c79d9b8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +123, Tests +235. Total +358 across 10 files. View PR surface stats
What I checked:
Likely related people:
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. How this review workflow works
|
278521d to
dce5d66
Compare
|
Updated head What changed since the earlier version:
Focused validation rerun:
|
dce5d66 to
8e24cb1
Compare
|
Updated head New live finding from a private Telegram topic: bounded session-init retries were present in Focused validation rerun:
|
8e24cb1 to
d54fc48
Compare
|
@clawsweeper re-review Rebased onto latest Head: Focused validation on the rebased head:
Live overlay proof:
Private Telegram links, chat IDs, message IDs, account identifiers, raw session routes, phone numbers, and endpoint details were intentionally redacted from public proof. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
d54fc48 to
1bf7951
Compare
27af295 to
d8d6f94
Compare
|
Updated this branch after the #96847 overlap landed. What changed:
Validation:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Landed via rebase onto main.
Thanks @VACInc! |
Port bounded retry-with-backoff to Signal's debounce flush path, matching the existing Slack/Telegram behavior for the same error class (openclaw#99647, openclaw#96550). - isRetryableSignalInboundError(): walks error cause chain matching "reply session initialization conflicted for ..." - flushWithRetry(): wraps handleSignalInboundMessage with up to 3 retries at 1s intervals - 6 proof tests (3 fake-timer + 3 real-environment wall-clock) - isRetryableSignalInboundError exported for external verification Fixes openclaw#100944
Port bounded retry-with-backoff to Signal's debounce flush path, matching the existing Slack/Telegram behavior for the same error class (openclaw#99647, openclaw#96550). - isRetryableSignalInboundError(): walks error cause chain matching "reply session initialization conflicted for ..." - flushWithRetry(): wraps handleSignalInboundMessage with up to 3 retries at 1s intervals - 6 proof tests (3 fake-timer + 3 real-environment wall-clock) - isRetryableSignalInboundError exported for external verification Fixes openclaw#100944
Port bounded retry-with-backoff to Signal's debounce flush path, matching the existing Slack/Telegram behavior for the same error class (openclaw#99647, openclaw#96550). - isRetryableSignalInboundError(): walks error cause chain matching "reply session initialization conflicted for ..." - flushWithRetry(): wraps handleSignalInboundMessage with up to 3 retries at 1s intervals - 6 proof tests (3 fake-timer + 3 real-environment wall-clock) - isRetryableSignalInboundError exported for external verification Fixes openclaw#100944
Port bounded retry-with-backoff to Signal's debounce flush path, matching the existing Slack/Telegram behavior for the same error class (openclaw#99647, openclaw#96550). - isRetryableSignalInboundError(): walks error cause chain matching "reply session initialization conflicted for ..." - flushWithRetry(): wraps handleSignalInboundMessage with up to 3 retries at 1s intervals - 6 proof tests (3 fake-timer + 3 real-environment wall-clock) - isRetryableSignalInboundError exported for external verification Fixes openclaw#100944
Port bounded retry-with-backoff to Signal's debounce flush path, matching the existing Slack/Telegram behavior for the same error class (openclaw#99647, openclaw#96550). - isRetryableSignalInboundError(): walks error cause chain matching "reply session initialization conflicted for ..." - flushWithRetry(): wraps handleSignalInboundMessage with up to 3 retries at 1s intervals - 6 proof tests (3 fake-timer + 3 real-environment wall-clock) - isRetryableSignalInboundError exported for external verification Fixes openclaw#100944
Summary
Back off retryable Telegram spool replays that fail with
reply session initialization conflicted...so one pending update cannot hot-loop the lane.This PR is now narrowed to the Telegram follow-up only. The reply-session writer-lane/root fix landed separately in #96847, so the overlapping session-store changes and extra stale-snapshot retry layer were removed from this branch.
What Problem This Solves
If a Telegram spooled update still hits a retryable reply-session initialization conflict, current
mainimmediately releases it back to pending. The drain loop can reclaim the same update every tick, repeatedly fail before an agent turn starts, and keep later same-DM/topic updates stuck behind the hot-looping row.Why This Change Was Made
Telegram now persists the retry error metadata already supported by the shared ingress queue. When the pending update's last error is a reply-session initialization conflict, the drain loop waits with capped exponential backoff before retrying that update again.
The same lane is reserved during the backoff window, so later messages in the same DM/topic do not overtake the conflicted update. Other lanes can still drain.
Upgrade And Data Compatibility
No new persisted fields or migrations. The change uses existing
attempts,lastAttemptAt, andlastErroringress-queue fields.User Impact
Telegram DMs and forum topics should stop hammering the gateway if a retryable session-init conflict remains after #96847. Same-lane ordering is preserved, and unrelated lanes can continue.
Review Updates
Addressed ClawSweeper feedback:
Evidence
What Was Not Tested
No full suite. No new live Telegram/Mantis proof was collected in this pass; the new regression covers both topic and direct-message lane behavior without private identifiers.