fix: recover from Telegram undici dispatcher failures in TUN/VPN environments, Issue 33013#33336
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 276c980ba7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR implements a three-stage fallback for Telegram's fetch path when undici dispatcher failures occur in TUN/VPN environments. The approach — capture baseline dispatcher → IPv4 fallback → restore baseline on second failure — is sound and correctly recovers from the stated issue. Key concern found: Resetting Test coverage gap: The new regression test confirms correct fetch call count and response success but does not assert that Proxy behavior, IPv4 fallback rules, and bot/send wiring are correctly implemented and tested. Docs changes are accurate (the Confidence Score: 2/5
Last reviewed commit: 276c980 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba4ccade85
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f54dbe1 to
debc9fa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: debc9fac4f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
Describe the problem and fix in 2–5 bullets:
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
Existing Telegram API calls only; retry behavior changed.
Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.Built with Codex
Build prompt-
Issue #33013 Implementation Plan (Telegram TUN/VPN regression)
Issue: #33013
Objective
Fix the Telegram regression reported in
2026.3.2for TUN/VPN environments while preserving existing proxy behavior and Node/Telegram networking guardrails.Hard Rules
scripts/committer "<msg>" <file...>for commits.Environment Matrix (required to satisfy “all CI/CD tests locally”)
Step 1: Create branch in fork (before any changes)
git checkout -b fix/issue-33013-telegram-tun-regressiongit branch --show-currentfix/issue-33013-telegram-tun-regressionStep 2: Install dependencies and capture tooling baseline
pnpm installnode -vpnpm -vbun -vpython3 --versionStep 3: Baseline CI/CD run before edits
3.1 Workflow sanity (
workflow-sanity.yml)python - <<'PY'\nfrom __future__ import annotations\nimport pathlib,sys\nroot=pathlib.Path('.github/workflows')\nbad=[]\nfor p in sorted(root.rglob('*.yml'))+sorted(root.rglob('*.yaml')):\n if b'\\t' in p.read_bytes():\n bad.append(str(p))\nif bad:\n print('Tabs found:')\n [print(x) for x in bad]\n sys.exit(1)\nPYpython3 scripts/check-composite-action-input-interpolation.pyactionlint(install if needed, then run)3.2 Core CI node/bun/check jobs (
ci.yml)pnpm canvas:a2ui:bundleOPENCLAW_TEST_WORKERS=2 OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=6144 pnpm testpnpm protocol:checkpnpm canvas:a2ui:bundle && bunx vitest run --config vitest.unit.config.tspnpm checkpnpm build:strict-smokepnpm lint:ui:no-raw-window-openpnpm buildpnpm release:check3.3 Skills + secrets jobs (
ci.yml)python -m pip install --upgrade pippython -m pip install pytest ruff pyyaml pre-commit detect-secrets==1.5.0python -m ruff check skillspython -m pytest -q skillsdetect-secrets scan --baseline .secrets.baselinepre-commit run --all-files detect-private-keypre-commit run --all-files pnpm-audit-prod3.4 Install smoke workflow (
install-smoke.yml)pnpm install --ignore-scripts --frozen-lockfiledocker build -t openclaw-dockerfile-smoke:local -f Dockerfile .docker run --rm --entrypoint sh openclaw-dockerfile-smoke:local -lc 'which openclaw && openclaw --version'CLAWDBOT_INSTALL_URL=https://openclaw.ai/install.sh CLAWDBOT_INSTALL_CLI_URL=https://openclaw.ai/install-cli.sh CLAWDBOT_NO_ONBOARD=1 CLAWDBOT_INSTALL_SMOKE_SKIP_CLI=1 CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS=1 pnpm test:install:smoke3.5 Sandbox smoke workflow (
sandbox-common-smoke.yml)scripts/sandbox-common-setup.shexactly as workflow does.sandbox.3.6 Platform-specific CI lanes (must run before push)
OPENCLAW_TEST_WORKERS=1 OPENCLAW_TEST_SHARDS=6 OPENCLAW_TEST_SHARD_INDEX=1 pnpm canvas:a2ui:bundle && pnpm test2..6.pnpm testswiftlint --config .swiftlint.ymlswiftformat --lint apps/macos/Sources --config .swiftformatswift build --package-path apps/macos --configuration releaseswift test --package-path apps/macos --parallel --enable-code-coverage --show-codecov-pathcd apps/android && ./gradlew --no-daemon :app:testDebugUnitTestcd apps/android && ./gradlew --no-daemon :app:assembleDebugStep 4: Add issue-reproduction unit tests (red-first)
src/telegram/fetch.test.ts.channels.telegram.proxywhen undici/global dispatcher path fails with network error.bunx vitest run src/telegram/fetch.test.tsscripts/committer "test(telegram): reproduce #33013 TUN/VPN fetch regression" src/telegram/fetch.test.tsStep 5: Implement smallest runtime fix
src/telegram/fetch.ts.channels.telegram.proxybehavior,bunx vitest run src/telegram/fetch.test.tsbunx vitest run src/telegram/proxy.test.tsscripts/committer "fix(telegram): recover from undici dispatcher failures in TUN/VPN environments" src/telegram/fetch.ts src/telegram/fetch.test.tsStep 6: Add integration tests for bot/send wiring
src/telegram/bot.create-telegram-bot.test.tssrc/telegram/send.proxy.test.tsbunx vitest run src/telegram/bot.create-telegram-bot.test.ts src/telegram/send.proxy.test.tsscripts/committer "test(telegram): verify bot and send paths use resilient fetch resolution" src/telegram/bot.create-telegram-bot.test.ts src/telegram/send.proxy.test.tsStep 7: Add docs troubleshooting update
docs/gateway/troubleshooting.mddocs/channels/telegram.md(if applicable).pnpm check:docsscripts/committer "docs(telegram): add TUN/VPN networking troubleshooting guidance" docs/gateway/troubleshooting.md docs/channels/telegram.mdStep 8: Full post-change validation (same breadth as Step 3)
3.1through3.6completely.Step 9: Rebase safety + quick rerun
git pull --rebase origin mainpnpm canvas:a2ui:bundle && pnpm testpnpm checkpnpm buildStep 10: Pre-push and push
git status --short ISSUE-33013-implementation-plan.mdgit log --oneline --decorate -n 20git push -u origin fix/issue-33013-telegram-tun-regressionDeliverables (done when all checked)