fix(telegram): enable autoSelectFamily by default for Node.js 22+#18272
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 16, 2026
Merged
fix(telegram): enable autoSelectFamily by default for Node.js 22+#18272steipete merged 2 commits intoopenclaw:mainfrom
steipete merged 2 commits intoopenclaw:mainfrom
Conversation
Fixes issue where Telegram fails to send messages when IPv6 is configured but not functional on the network. Problem: - Many networks (especially in Latin America) have IPv6 configured but not properly routed by ISP/router - Node.js tries IPv6 first, gets 'Network is unreachable' error - With autoSelectFamily=false, Node doesn't fallback to IPv4 - Result: All Telegram API calls fail Solution: - Change default from false to true for Node.js 22+ - This enables automatic IPv4 fallback when IPv6 fails - Config option channels.telegram.network.autoSelectFamily still available for users who need to override Symptoms fixed: - Health check: Telegram | WARN | failed (unknown) - fetch failed - Logs: Network request for 'sendMessage' failed - Bot receives messages but cannot send replies Tested on: - macOS 26.2 (Sequoia) - Node.js v22.15.0 - OpenClaw 2026.2.12 - Network with IPv6 configured but not routed
Contributor
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/telegram/network-config.test.ts
Line: 39:42
Comment:
**Test expects old default value**
This test still asserts `value: false` for the Node 22 default, but the implementation now returns `true`. This test will fail. The test name and assertion need to be updated to reflect the new behavior.
```suggestion
it("defaults to enable on Node 22", () => {
const decision = resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
expect(decision).toEqual({ value: true, source: "default-node22" });
});
```
How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: src/telegram/fetch.ts
Line: 10:10
Comment:
**Stale comment contradicts new behavior**
This comment says "disable autoSelectFamily" but the default behavior for Node 22+ is now to *enable* it. Consider updating the comment to reflect the new intent, e.g.:
```suggestion
// Node 22 workaround: enable autoSelectFamily for IPv4 fallback on broken IPv6 networks.
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
- Update test expectation: 'defaults to enable on Node 22' - Update comment in fetch.ts to explain IPv4 fallback rationale - Addresses greptile review feedback
This was referenced Feb 20, 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.
Problem
Telegram plugin fails to send messages when IPv6 is configured but not functional on the network (common in many regions, especially Latin America).
Fixes #18279
Symptoms
Telegram │ WARN │ failed (unknown) - fetch failedNetwork request for 'sendMessage' failedNetwork is unreachableRoot Cause
The current default (
autoSelectFamily=falsefor Node.js 22+) prevents Node from falling back to IPv4 when IPv6 fails. This breaks Telegram on networks where:-4works fine, but Node.js failsSolution
Change the default from
falsetotruefor Node.js 22+:This enables automatic IPv4 fallback when IPv6 fails, matching standard Node.js behavior.
Backward Compatibility
channels.telegram.network.autoSelectFamilystill available for overrideOPENCLAW_TELEGRAM_ENABLE_AUTO_SELECT_FAMILYandOPENCLAW_TELEGRAM_DISABLE_AUTO_SELECT_FAMILYstill workTesting
Tested on:
Before fix:
After fix:
Changes in this PR
src/telegram/network-config.ts: Change default fromfalsetotruesrc/telegram/network-config.test.ts: Update test expectationsrc/telegram/fetch.ts: Update comment to reflect new behaviorNote: The original hardcoded
falsewas likely added as a workaround for Node.js 22 compatibility, but it causes more problems than it solves. Thetruedefault is safer for most networks and matches standard Node.js behavior.