Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR keeps Telegram retries pending until their original handlers settle, while continuing to suppress completed duplicates. Example: A voice note takes 45 seconds to transcribe with a 30-second ingress timeout, followed four seconds later by text.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this PR fixes Telegram message loss still present on main, and the prior test-cancellation finding is resolved; no actionable findings remain. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTelegram polling and webhook ingress persist updates in SQLite; the shared drain sends them through Telegram middleware and uses recorded processing outcomes to retain retries or complete queue rows. flowchart TD
A[Telegram updates] --> B[Durable ingress queue]
B --> C[Shared drain]
C --> D[Telegram update tracker]
D --> E[Sequential middleware]
E --> F[Agent turn]
D --> G[Processing outcome]
F --> G
G --> B
Technical reviewBest possible solution: Land the focused tracker classification repair while leaving broader historical variants with their canonical issue. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the pending-duplicate-to-completion path, corroborated by official-release reports and supplied baseline Gateway diagnostics; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs classification at the existing Telegram tracker and carries that fact through the existing processing frame, preserving shared retry policy and participant settlement ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6dc4f1b5cf54. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +17, Tests +92. Total +109 across 5 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 14, 2026, 6:54 PM ET / 22:54 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 6d624f3. Thanks @diregoblin! Verified on the Telegram Test Server: a voice note whose transcription outlasts the handler timeout is now answered instead of dropped. |
…169202) fix(telegram): keep timed-out updates for retry instead of dropping them When a Telegram update's handler ran past the spooled-handler timeout (for example, a voice note waiting on slow speech transcription), the retry found the original handler still pending. The duplicate tracker treated that as already completed, the middleware recorded no outcome, and the drain marked the update done and removed it. The voice note was never answered, and users saw long typing with no reply. A still-pending original now keeps the update queued for retry, so it is processed once and later messages keep their order. Proof: Telegram Test Server with a real user and a built Gateway, a 30s handler timeout and a transcriber whose first call takes 45s. On main the voice note was dropped after the timeout. With this change the bot replied to the voice note and then to the follow-up text, once each, in order. Fast-transcriber and real-provider controls are unchanged. This matches Discord reports of Telegram typing with no reply. Related to openclaw#127229. Thanks @diregoblin. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(telegram): keep timed-out updates for retry instead of dropping them When a Telegram update's handler ran past the spooled-handler timeout (for example, a voice note waiting on slow speech transcription), the retry found the original handler still pending. The duplicate tracker treated that as already completed, the middleware recorded no outcome, and the drain marked the update done and removed it. The voice note was never answered, and users saw long typing with no reply. A still-pending original now keeps the update queued for retry, so it is processed once and later messages keep their order. Proof: Telegram Test Server with a real user and a built Gateway, a 30s handler timeout and a transcriber whose first call takes 45s. On main the voice note was dropped after the timeout. With this change the bot replied to the voice note and then to the follow-up text, once each, in order. Fast-transcriber and real-provider controls are unchanged. This matches Discord reports of Telegram typing with no reply. Related to #127229. Thanks @diregoblin. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 6d624f3)
…169202) fix(telegram): keep timed-out updates for retry instead of dropping them When a Telegram update's handler ran past the spooled-handler timeout (for example, a voice note waiting on slow speech transcription), the retry found the original handler still pending. The duplicate tracker treated that as already completed, the middleware recorded no outcome, and the drain marked the update done and removed it. The voice note was never answered, and users saw long typing with no reply. A still-pending original now keeps the update queued for retry, so it is processed once and later messages keep their order. Proof: Telegram Test Server with a real user and a built Gateway, a 30s handler timeout and a transcriber whose first call takes 45s. On main the voice note was dropped after the timeout. With this change the bot replied to the voice note and then to the follow-up text, once each, in order. Fast-transcriber and real-provider controls are unchanged. This matches Discord reports of Telegram typing with no reply. Related to openclaw#127229. Thanks @diregoblin. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 6d624f3) (cherry picked from commit c09a6dd) Co-authored-by: RomneyDa <[email protected]>
…claim hold telegram-ingress-coalescing.e2e.test.ts > "keeps a timed-out update retryable while its original middleware is still waiting" fails on the stack, on 3eefd13 and on the deployed 11.1 carry (eee763b), and passes on bare v2026.11.2. Upstream added it with openclaw#169202 (6d624f3, 2026-10-15). There the stall watchdog re-queues a timed-out update as pending with handler-timeout while its original middleware still waits, and the retry records "Telegram update processing is still pending" until the original returns. The fork carries upstream openclaw#132409 (closed upstream unmerged; carried since da9b206fc93, now through 1e127ad). Its stall watchdog (ingress-drain-watchdog.ts) releases the timed-out claim only once the original dispatch has quiesced (beforeRetryRelease -> waitForQuiescenceOrStop). The test pinned openclaw#169202's in-between state, so it cannot pass with openclaw#132409. Alex chose to keep openclaw#132409, so the upstream test is replaced by a pin of the fork's behavior, marked FORK DIVERGENCE (openclaw#132409): "holds a timed-out update's claim until its original middleware returns, then retries it once". The pin lives in a new fork-only file, extensions/telegram/src/telegram-ingress-claim-hold.e2e.test.ts, with the subset of the coalescing harness a text-only case needs (the same mocks, fixture and import order). The upstream file was already over the 1,000-line test cap at the tag (1,014 counted lines, so oxlint max-lines fails on it). Moving the replaced case out brings it to 928, and later upstream merges of that file only see the case removed. The assertions are what an instrumented run measured on the stack: - at 300 s the watchdog has fired, and 802 is still claimed with attempts 0 and no lastError. It is not pending and not failed. - 803, admitted then, stays pending behind it, and 802 is not handed to handleUpdate again. - after 801 finishes and the drain runs, handleUpdate has seen 802, 802, 803 (the original, then the one retry), and the downstream turns are "busy turn", "deliver this later", "deliver after the retry". - nothing is left pending, claimed or failed, both updates are tombstoned, and a redelivered 802 is skipped. The same measurement shows no message loss: the update is processed once, and in order. Proof (M4, Node 26.12.1, node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts <file>), on 1daeda2 plus this commit: - telegram-ingress-coalescing.e2e.test.ts 20/20 passed. telegram-ingress-claim-hold.e2e.test.ts 1/1 passed. - Red check (throwaway commit): with the watchdog's quiescence wait skipped (env toggle), the pin fails at the 300 s assertion, because 802 is already pending with lastError "Channel ingress claim->adoption stalled for event 802 ... (handler-timeout)". Without the toggle it passes. - Gates: check-line-cap-ratchet --base v2026.11.2 rc 0, run-oxlint on both files rc 0, check-test-mock-exports --base v2026.11.2 rc 0 (the new file's three isolating mocks carry mock-isolation reasons), tsgo:extensions:test rc 0, and oxfmt --check on both files rc 0.
Related: #127229 (the pending-update retry variant)
What Problem This Solves
Fixes Telegram messages disappearing when a slow ingress handler times out and its retry is mistaken for an already completed duplicate.
User Impact
Timed-out messages remain retryable and are processed once before their queued followers. Completed duplicates remain suppressed. No configuration, schema, retention, retry-budget, permission, or protocol changes are required.
Why This Change Was Made
The existing tracker distinguishes pending from completed duplicates, and middleware records the corresponding retryable or skipped outcome. The shared drain still owns retries and FIFO ordering.
This retains @diregoblin's fix and regression while removing the broader missing-outcome fallback change and its separate test. The regression uses the existing
withinTestcancellation helper, as in #170943, so a cancelled test releases its held turn before cleanup joins it.Production delta against the merge base: +21/-4. Tests and support: +97/-5. Total: 127 changed lines, down from 186. The production growth represents the missing pending outcome, not new state or a second retry owner.
No overlap with Pash/Sarah changes.
Community evidence: Discord records
1552978751803883622and1552978923665621144describe prolonged typing without a reply. The canonical issue also contains historical variants outside this focused repair.Evidence
Real Telegram Test Server, Convex-leased TDLib user, built Gateway; baseline
923e59a01e20549965381a1e72a471762981db9d, final candidate4d38a28bd39c6836388c2f8f28af6643ca0da93b.Both refs received a real voice note followed four seconds later by uniquely marked text. The local OpenAI-compatible transcription fixture delayed its first request 45 seconds and returned subsequent requests immediately. Both used the existing
OPENCLAW_TELEGRAM_SPOOLED_HANDLER_TIMEOUT_MS=30000, implemented in the Telegram drain and documented inextensions/telegram/AGENTS.md.OPENCLAW_E2E_FOLLOWER_169202at 51.45s; no voice reply during the 100s recordingOPENCLAW_E2E_VOICE_169202at 52.58s, thenOPENCLAW_E2E_FOLLOWER_169202at 53.60s; each oncegpt-5-miniplus fast transcriptionThe model fixture acknowledges each new user marker in order; it does not invent a voice acknowledgment when the voice input is absent. Baseline model input contained only the follower; candidate inputs contained the voice and follower once each, in order.
Sanitized shipped diagnostic evidence:
The worker-backed regression fails on baseline because the expected pending voice and follower rows are already gone. Final candidate: 30 focused tests passed across tracker and ingress-coalescing suites in 30.79s; the new regression body took 2.96s. Formatting, focused lint and the runtime build passed.
Cancellation proof held the regression's downstream gate, then let the actual Vitest 10-second timeout abort its test signal. The held-gate and completed-cleanup receipts were both observed; the runner exited with only the intended test timeout and no hook timeout. The transient fault injection was removed before normal tests and the build.
The previous production-identical head's hosted CI passed; final-head CI and review are requested after this cancellation-only follow-up. All live leases were released and temporary credential files removed.
Merge danger: two-way door for future processing; reverting restores the old dedupe behavior. Neither this fix nor a revert can recover payloads already scrubbed by the old behavior. Blast radius is Telegram ingress duplicate classification and retry ordering only.