Skip to content

fix: handle Telegram poll conflicts and ngrok dev URLs#43

Open
fengjikui wants to merge 1 commit into
lesquel:mainfrom
fengjikui:codex/telegram-ngrok-conflict
Open

fix: handle Telegram poll conflicts and ngrok dev URLs#43
fengjikui wants to merge 1 commit into
lesquel:mainfrom
fengjikui:codex/telegram-ngrok-conflict

Conversation

@fengjikui

Copy link
Copy Markdown

Fixes #42

Summary

  • stop the Telegram long-poll loop when Telegram reports that another getUpdates poller is already active
  • keep the first active poller running instead of retrying duplicate pollers forever
  • recognize ngrok-free .dev tunnel URLs in tunnel output parsing

Root cause

OpenCode can initialize the plugin twice in the same process, which starts duplicate Telegram getUpdates loops. Telegram rejects the duplicate long poll with a 409 conflict, but the plugin treated it as a generic transient polling failure and retried indefinitely. The ngrok tunnel extractor also only matched .app ngrok domains, so .ngrok-free.dev URLs were ignored.

Validation

  • failing-first bun test src/infra/tunnel/__tests__/url-extractor.test.ts failed before the regex change and passes after
  • failing-first bun test src/notifications/channels/telegram/index.test.ts failed before the poll conflict handling and passes after
  • bun run typecheck
  • bun run lint (0 errors; existing warnings remain)
  • bun test (733 pass)
  • bun run prepublishOnly
  • git diff --check

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 409 Conflict on startup (double getUpdates poller) + ngrok .dev domains not recognized

1 participant