Skip to content

fix: surface stalled Telegram ingress backlog#82288

Merged
steipete merged 1 commit into
mainfrom
codex/telegram-ingress-liveness
May 15, 2026
Merged

fix: surface stalled Telegram ingress backlog#82288
steipete merged 1 commit into
mainfrom
codex/telegram-ingress-liveness

Conversation

@steipete

@steipete steipete commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Marks isolated Telegram polling unhealthy when a spooled inbound backlog is blocked behind a stale handler even though Bot API polling still succeeds.
  • Keeps active spooled lane guards process-wide across isolated-ingress and account restarts, preventing duplicate handling of the same spool file after restart recovery.
  • Preserves the latest main reconnect-drain behavior: successful getUpdates still drains queued outbound deliveries, but does not turn channel health green while the inbound spool remains wedged.
  • Adds status wording for this backlog-stall case and changelog credit for Telegram provider can wedge after stale-socket recovery while gateway health stays green #82175.

Fixes #82175.

Verification

  • node scripts/run-vitest.mjs extensions/telegram/src/polling-session.test.ts extensions/telegram/src/status.test.ts extensions/telegram/src/polling-status.test.ts -- --reporter=verbose
  • /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch
  • git diff --check
  • Dependency/API contract review: Telegram Bot API getUpdates/webhook contract; installed [email protected] and @grammyjs/[email protected] source/types for offset, stop, and sequential handling behavior.

Real behavior proof

Behavior addressed: Telegram isolated polling no longer reports healthy solely from worker getUpdates success when main-thread spooled update handling wedges behind a stale same-lane handler.

Real environment tested: Local OpenClaw checkout with Telegram plugin unit/runtime tests after rebasing on latest origin/main.

Exact steps or command run after this patch: node scripts/run-vitest.mjs extensions/telegram/src/polling-session.test.ts extensions/telegram/src/status.test.ts extensions/telegram/src/polling-status.test.ts -- --reporter=verbose; Codex review command above; git diff --check.

Evidence after fix: Focused tests pass 57/57, including backlog liveness, isolated-ingress restart, account-restart duplicate guard, outbound reconnect-drain integration, and distinct status issue coverage. Codex review returned clean with no accepted/actionable findings.

Observed result after fix: A stalled spooled backlog publishes a polling error and suppresses later worker poll-success health updates until the backlog drains; active spooled lanes remain blocked across a new account session in the same gateway process; successful polling can still drain queued outbound delivery retries.

What was not tested: Live Telegram Bot API end-to-end traffic was not run. Broad pnpm check:changed was not completed in this turn; the reviewer attempted pnpm tsgo:extensions:test, but pnpm failed before type output with [ERROR] fetch failed.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: M maintainer Maintainer-authored PR labels May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Summary
The PR adds Telegram isolated-ingress backlog-stall detection and status wording, process-wide spooled lane guards across restarts, focused tests, and a changelog entry for the linked Telegram health issue.

Reproducibility: no. high-confidence live reproduction was established in this review. Source inspection and the proposed tests show a clear synthetic path where a spooled handler blocks while worker getUpdates continues succeeding.

Real behavior proof
Needs real behavior proof before merge: The PR body provides focused test evidence only; add redacted live Telegram proof, update the PR body, and ClawSweeper should re-review automatically or via @clawsweeper re-review.

Next step before merge
The remaining blocker is contributor/maintainer live Telegram proof and draft protected review handling, not a narrow repairable code defect.

Security
Cleared: The diff stays within Telegram plugin runtime/status/tests and changelog files and does not alter secrets, dependencies, CI, or package execution paths.

Review details

Best possible solution:

Keep the Telegram-plugin fix path, but require redacted live Telegram ingress/status proof before maintainer review or merge.

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

No high-confidence live reproduction was established in this review. Source inspection and the proposed tests show a clear synthetic path where a spooled handler blocks while worker getUpdates continues succeeding.

Is this the best way to solve the issue?

Mostly yes: the fix belongs in the Telegram plugin polling/session health path and now preserves the reconnect delivery drain. It is not merge-ready until the live Telegram proof requirement is satisfied.

Acceptance criteria:

  • Add redacted live Telegram Bot API/ingress proof showing the stalled-backlog health path after the patch.
  • Keep the focused test command from the PR body passing: node scripts/run-vitest.mjs extensions/telegram/src/polling-session.test.ts extensions/telegram/src/status.test.ts extensions/telegram/src/polling-status.test.ts -- --reporter=verbose
  • Confirm git diff --check after any further branch update.

What I checked:

Likely related people:

  • steipete: Recent current-main work added the Telegram reconnect delivery drain that this PR must preserve, and nearby Telegram polling commits are on the same runtime/status path. (role: recent area contributor; confidence: high; commits: 7270bb95b70e, de1ac12f1c04, 1fb58ca5eee0; files: extensions/telegram/src/polling-session.ts, extensions/telegram/src/polling-session.test.ts, extensions/telegram/src/status-issues.ts)
  • joshavant: Current-main history ties this handle to the Telegram polling ingress event-loop stall work that introduced the isolated-ingress/spool surface involved here. (role: isolated ingress feature author; confidence: medium; commits: fd244fd76de3; files: extensions/telegram/src/polling-session.ts, extensions/telegram/src/telegram-ingress-spool.ts)
  • obviyus: Recent current-main history shows adjacent Telegram polling stall detection and spooled lane tracking work on this code path. (role: recent polling/status contributor; confidence: medium; commits: 56873b606578, 52c9860bdecf; files: extensions/telegram/src/polling-session.ts, extensions/telegram/src/polling-session.test.ts)

Remaining risk / open question:

  • Live Telegram Bot API/ingress proof is still absent; the current proof is focused tests only.
  • This read-only review did not run tests, so it relies on source/diff inspection and the PR-reported focused test result.

Codex review notes: model gpt-5.5, reasoning high; reviewed against ba8a6499f02f.

@steipete
steipete force-pushed the codex/telegram-ingress-liveness branch from 0b6881a to 7c9f901 Compare May 15, 2026 19:57
@steipete
steipete marked this pull request as ready for review May 15, 2026 20:47
@steipete steipete added proof: override Maintainer override for the external PR real behavior proof gate. and removed proof: override Maintainer override for the external PR real behavior proof gate. labels May 15, 2026
@steipete
steipete merged commit 25a8f5f into main May 15, 2026
136 of 148 checks passed
@steipete
steipete deleted the codex/telegram-ingress-liveness branch May 15, 2026 20:52
@steipete

Copy link
Copy Markdown
Contributor Author

Landed via rebase onto main.

Thanks @shellyrocklobster for the report.

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 proof: override Maintainer override for the external PR real behavior proof gate. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram provider can wedge after stale-socket recovery while gateway health stays green

1 participant