Skip to content

fix(core): surface Telegram webhook errors and validate secret (#9018) - #9039

Open
TbhVishal wants to merge 16 commits into
BuilderIO:mainfrom
TbhVishal:fix/telegram-webhook-error-handling
Open

TbhVishal wants to merge 16 commits into
BuilderIO:mainfrom
TbhVishal:fix/telegram-webhook-error-handling

Conversation

@TbhVishal

@TbhVishal TbhVishal commented Nov 10, 2026 •

Copy link
Copy Markdown

Fixes #9018

Returning 502 when Telegram setWebhook fails causes Cloudflare to replace the JSON response with an HTML error page, masking Telegram's error description from the user. Replaces 502 with non-5xx statuses that reverse proxies pass through to the client:

  • 422 for client/validation rejections from Telegram (< 500)
  • 429 for provider rate limits (setting Retry-After and forwarding retryAfterSeconds and upstreamStatus)
  • 424 Failed Dependency for upstream timeouts (408), 5xx outages, and network failures (forwarding upstreamStatus)

Also validates that TELEGRAM_WEBHOOK_SECRET matches allowed characters ^[A-Za-z0-9_-]{1,256}$ before dispatching to Telegram, and forwards upstreamStatus and retryAfterSeconds through action error details.

Validation:

pnpm --filter @agent-native/core test integrations/adapters/telegram.spec.ts integrations/channel-settings.spec.ts integrations/plugin.spec.ts

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

@builder-io-integration

Copy link
Copy Markdown
Contributor

⚠️ Review Agent ran into a problem and couldn't finish reviewing the latest commit.

We've been automatically notified and are looking into it. Push a new commit to re-trigger the review, or contact support@builder.io if this keeps happening.

Error ID: 0fcca508286746108b88d9450090953b

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes — looks good ✅

Review Details

Incremental Review Summary

The latest update removes the 300-second cap and now forwards Telegram's validated positive retry_after unchanged through the Retry-After header and action details. The previously reported premature-retry issue is fixed and its comment thread has been resolved. Two independent review agents found no new actionable issues; malformed upstream payload handling, request timeout behavior, status mapping, and propagation across HTTP/action paths also look consistent. Credential validation remains enforced before saving and before webhook dispatch. Risk remains high because this change covers credential validation and provider failure handling.

🧪 Browser testing: Skipped — browser-test-planner is unavailable in this session; the changed credential help text is user-facing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram "register webhook" hides Telegram's error behind a 502, and the webhook secret field accepts values Telegram rejects

1 participant