Repository navigation
Fix Telegram polling lease cleanup on restart - #81890
Conversation
ec044c5 to
cc5a506
Compare
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main has a source-level reproduction path through the process-global lease map and duplicate guard, and the PR body reports Crabbox AWS output showing duplicate refusal before cleanup and successful same-token acquire after cleanup. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this narrow Telegram-owned cleanup after normal checks, then close #81507 and decide whether #81533 should be superseded. Do we have a high-confidence way to reproduce the issue? Yes. Current main has a source-level reproduction path through the process-global lease map and duplicate guard, and the PR body reports Crabbox AWS output showing duplicate refusal before cleanup and successful same-token acquire after cleanup. Is this the best way to solve the issue? Yes. The PR fixes the Telegram-owned lifecycle leak at the existing channel stop hook, which is narrower than adding a new public restart-hook SDK surface and still preserves active duplicate-poller protection. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 386d321634b3. |
cc5a506 to
8b67d23
Compare
* fix(telegram): release stopped polling leases * docs: add Telegram polling lease changelog
* fix(telegram): release stopped polling leases * docs: add Telegram polling lease changelog
* fix(telegram): release stopped polling leases * docs: add Telegram polling lease changelog
Summary
Fixes #81507.
Verification
node scripts/run-vitest.mjs extensions/telegram/src/polling-lease.test.ts extensions/telegram/src/channel.gateway.test.ts -- --reporter=verbosecodex review --uncommittedrun_615353431110against the synced dirty branch: reproduced duplicate before cleanup, thenCLEANUP released=true, then acquired the same token lease after cleanup.Real behavior proof
Behavior addressed: Telegram polling leases leaked across in-process gateway restarts and caused duplicate-poller refusal for a stopped account using the same bot token.
Real environment tested: Crabbox AWS Linux, source checkout synced from
fix/telegram-polling-lease-restartat base head1f45b37fe17cf4fa292437f3c586183ccde3e421plus the local Telegram polling lease diff.Exact steps or command run after this patch: Created an aborted Telegram polling lease for account
default, confirmed a second acquire with the same token failed with the duplicate-poller error, called stopped-lease cleanup, then acquired the same token lease again.Evidence after fix: Crabbox run
run_615353431110printedBEFORE_ABORT duplicate-error,CLEANUP released=true, andAFTER_CLEANUP acquired fingerprint=cc06801bc84c3cb4, exit 0.Observed result after fix: The stale stopped lease is cleared only after the stopped poller path is considered stopped; active/no-signal/non-aborted leases remain protected.
What was not tested: A full live Telegram Desktop or Bot API end-to-end message roundtrip was not rerun for this patch; the original Convex-leased Telegram credential reproduction established the real credential shape supports the issue reproduction.