Skip to content

fix: Telegram API requests fail with Network request failed after#38056

Merged
obviyus merged 4 commits intoopenclaw:mainfrom
0xlin2023:fix/28835-telegram-api-requests-fail-wit
Mar 6, 2026
Merged

fix: Telegram API requests fail with Network request failed after#38056
obviyus merged 4 commits intoopenclaw:mainfrom
0xlin2023:fix/28835-telegram-api-requests-fail-wit

Conversation

@0xlin2023
Copy link
Copy Markdown

Fixes #28835

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: S labels Mar 6, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR fixes two independent issues: (1) Telegram API requests that surface as grammY "Network request for '...' failed[!]" / "failed after N attempts." errors were not being retried in the send context — a new dedicated regex (GRAMMY_NETWORK_REQUEST_FAILED_RE) is added and checked before the allowMessageMatch guard so these errors are always classified as recoverable regardless of context. (2) On Windows with Bun (which doesn't ship npm-cli.js next to process.execPath), resolveNpmArgvForWindows was returning null and falling through to a plain command resolution that could trigger spawn EINVAL; the fix falls back to npm.cmd/npx.cmd, which are then detected by isWindowsBatchCommand and correctly routed through cmd.exe.

Key changes:

  • src/telegram/network-errors.ts: New GRAMMY_NETWORK_REQUEST_FAILED_RE regex added; matched before the allowMessageMatch guard so grammY envelope errors are retried even in send context.
  • src/process/exec.ts: resolveNpmArgvForWindows now falls back to npm.cmd shim when npm-cli.js is not found, ensuring Windows + Bun spawns are routed through cmd.exe correctly.
  • Tests are appropriately added for both changes; the existing "skips broad message matches for send context" test was correctly updated to use a "timed out" variant that still exercises the allowMessageMatch guard.

No issues found. Both fixes are narrow, well-tested, and the logic in each path is correct.

Confidence Score: 5/5

  • This PR is safe to merge — both fixes are narrow, well-tested, and logically sound.
  • The regex change is precise and cannot accidentally match non-network errors. The Windows/Bun fallback correctly routes through cmd.exe via the existing isWindowsBatchCommand guard. New tests directly exercise both code paths.
  • No files require special attention.

Last reviewed commit: a3be9b0

@obviyus obviyus self-assigned this Mar 6, 2026
@obviyus obviyus force-pushed the fix/28835-telegram-api-requests-fail-wit branch from 459f1e9 to f34d73f Compare March 6, 2026 16:49
@obviyus obviyus merged commit f9d86b9 into openclaw:main Mar 6, 2026
6 checks passed
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Mar 6, 2026

Landed via temp rebase onto main.

  • Gate: pnpm test src/process/exec.test.ts src/process/exec.windows.test.ts src/telegram/network-errors.test.ts src/telegram/send.test.ts ; pnpm tsgo ; pnpm exec oxlint src/process/exec.ts src/process/exec.test.ts src/process/exec.windows.test.ts src/telegram/network-errors.ts src/telegram/network-errors.test.ts src/telegram/send.test.ts ; pnpm exec oxfmt --check CHANGELOG.md src/process/exec.ts src/process/exec.test.ts src/process/exec.windows.test.ts src/telegram/network-errors.ts src/telegram/network-errors.test.ts src/telegram/send.test.ts
  • Land commit: f34d73f
  • Merge commit: f9d86b9

Thanks @0xlin2023!

ant1eicher pushed a commit to ant1eicher/openclaw that referenced this pull request Mar 6, 2026
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram API requests fail with Network request failed after upgrade from v2026.2.23 to v2026.2.26 (Node HTTPS timeout while curl succeeds)

2 participants