fix: handle Telegram network errors gracefully to prevent gateway crashes#3013
Merged
thewilloftheshadow merged 2 commits intoopenclaw:mainfrom Jan 28, 2026
Conversation
…shes - Expand recoverable error codes (ECONNABORTED, ERR_NETWORK) - Add message patterns for 'typeerror: fetch failed' and 'undici' errors - Add isNetworkRelatedError() helper for broad network failure detection - Retry on all network-related errors instead of crashing gateway - Remove unnecessary 'void' from fire-and-forget patterns - Add tests for new error patterns Fixes openclaw#3005
d65736a to
0d1938a
Compare
Member
|
Landed via temp rebase onto main.
Thanks @ryancontent! |
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
bestNiu
pushed a commit
to bestNiu/clawdbot
that referenced
this pull request
Feb 5, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix unhandled promise rejections from Telegram API fetch failures that crash the entire gateway, terminating all running agents.
Problem
When Telegram API calls fail due to network issues, unhandled promise rejections can escape error handling and crash the entire gateway. This was observed with ~74 gateway restarts in a single day during network instability.
Solution
isNetworkRelatedError()helper for broad network failure detectionvoid)Testing
pnpm test src/telegram/network-errors.test.ts)Related Issues
Fixes #3005
Related to #2876
AI Disclosure
This PR was developed with AI assistance (Claude). The code has been reviewed and tested.