Skip to content

Fix Telegram polling ingress under event-loop stalls - #81746

Merged
joshavant merged 2 commits into
mainfrom
fix/telegram-isolated-ingress-spool
May 14, 2026
Merged

joshavant merged 2 commits into
mainfrom
fix/telegram-isolated-ingress-spool

Conversation

@joshavant

@joshavant joshavant commented May 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary:

  • Move Telegram Bot API polling ingress into an isolated worker so main event-loop saturation does not stop getUpdates.
  • Spool fetched Telegram updates durably before advancing the offset, then drain them through the normal main-thread bot handler.
  • Clear stale queued diagnostic session state when no active lane work remains.

Fixes #81132.

Verification:

Real behavior proof

Behavior addressed: Telegram polling could stop making Bot API progress when the main OpenClaw event loop was saturated, so messages could sit unfetched or be lost from the runtime path.

Real environment tested: Crabbox Blacksmith Testbox Linux runner, built package output, emitted Telegram ingress worker runtime, fake local Telegram Bot API server, deliberate 5s main-thread event-loop block.

Exact steps or command run after this patch: pnpm build >/tmp/openclaw-81132-build.log && node scripts/tmp-telegram-ingress-stall-repro.mjs during Testbox run https://github.com/openclaw/openclaw/actions/runs/25849195345.

Evidence after fix: Terminal output from Testbox run https://github.com/openclaw/openclaw/actions/runs/25849195345: {"ok":true,"blockMs":5000,"hitCount":64228,"firstHitOffsetMs":119,"spooledUpdateIds":[81132001]}.

Observed result after fix: The worker fetched and durably spooled the update while the main thread was blocked, proving ingress is no longer coupled to main event-loop availability.

What was not tested: A live human Telegram user roundtrip under saturation was not run because the available issue credential file had bot-side credentials, not a Telegram user-driver credential. The repro uses a fake Bot API server to isolate the exact event-loop saturation failure mechanism.

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

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Fix Telegram polling ingress under event-loop stalls This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@joshavant
joshavant merged commit fd244fd into main May 14, 2026
114 of 118 checks passed
@joshavant
joshavant deleted the fix/telegram-isolated-ingress-spool branch May 14, 2026 08:35
joshavant added a commit that referenced this pull request May 14, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix

(cherry picked from commit fd244fd)
nighting0615 pushed a commit to nighting0615/openclaw that referenced this pull request May 19, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix

(cherry picked from commit fd244fd)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix
ericksoninco pushed a commit to ericksoninco/openclaw that referenced this pull request Jun 9, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* fix telegram polling ingress under event-loop stalls

* add changelog for telegram ingress fix

(cherry picked from commit fd244fd)
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 size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram polling stalls when event loop is saturated — messages lost

1 participant