diff options
| author | Noah Zweben <noahz@anthropic.com> | 2026-04-10 12:01:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-10 12:01:01 -0700 |
| commit | 58578a456a83f3480a5fe21f8b8cfdd38dfa3152 (patch) | |
| tree | d32d714c589fe42b842c53997160a22cd658d43b /plugins/plugin-dev/skills/plugin-settings/examples | |
| parent | 1057d02c53077c88d365d160951828c5cba1c69a (diff) | |
fix(telegram): prevent zombie pollers from blocking new sessions with 409 Conflict (#1349)
* fix(telegram): prevent zombie pollers from blocking new sessions
The MCP server runs as a grandchild of the CLI (via `bun run start` →
shell → `bun server.ts`). When the CLI is killed uncleanly (SIGKILL,
crash, terminal close), the grandchild survives as an orphan and keeps
long-polling getUpdates indefinitely. Telegram allows only one consumer
per token, so every subsequent session sees 409 Conflict and the
existing retry loop spins forever.
Three layered mitigations:
- PID lockfile (STATE_DIR/bot.pid): on startup, SIGTERM any stale holder
before claiming the slot, so a fresh session always wins.
- Orphan watchdog: every 5s check for parent reparenting (POSIX ppid
change) or a dead stdin pipe, and self-terminate. Covers cases where
the existing stdin end/close events never fire through the wrapper.
- 409 retry cap: give up after 8 attempts (~28s) instead of looping
forever, and bail immediately if shutdown has begun.
Also adds a SIGHUP handler and removes the pidfile on clean shutdown
(only if still owned by this process).
* chore(telegram): bump version to 0.0.5
---------
Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'plugins/plugin-dev/skills/plugin-settings/examples')
0 files changed, 0 insertions, 0 deletions
