fix(telegram): acknowledge unhandled callback queries - #78874
fix(telegram): acknowledge unhandled callback queries#78874Kailigithub wants to merge 2 commits into
Conversation
|
This was generated by AI during triage. The unconditional Problems:
Suggested changes:
Checked against |
Forward-compatible with NousResearch#78619: if _dispatch_plugin_callback_handlers is registered (post-NousResearch#78619 merge), the ack is only emitted when the plugin dispatch returns False (no handler consumed). Plugin handlers that already call query.answer() themselves no longer see a second answerCallbackQuery that PTB rejects with a 400. When the dispatch method is absent (current main), behavior is unchanged from the prior fix: the unconditional ack clears the client loading indicator. Adds regression test covering the gated-on-dispatch path.
acfb985 to
572b3da
Compare
|
Thanks for the close read — your point about the double- race with #78619 is correct as a forward-compat concern, and I've just pushed a follow-up commit that addresses it. Update on the head: the new commit gates the fall-through ack on when that method is registered: dispatch = getattr(self, "_dispatch_plugin_callback_handlers", None)
if dispatch is None:
await query.answer()
else:
if not await dispatch(query, data):
await query.answer()Behavior matrix:
The new regression test CI rerun queued — full Closes #78788 |
|
Minor correction to my previous comment (bash ate some backticks): The reviewer's concern is specifically about the double- The gating approach above (commit on branch tip) eliminates that race for the post-#78619 state while preserving the unconditional ack for the current main state. Thanks again for the careful review. |
|
Campaign interlock: this PR is tracked by Telegram Revolution EPIC #78791 as the callback-query fix candidate. Existing authorship and useful work remain preserved; implementation acceptance is adjudicated separately. |
Summary
Verification
python3 -m py_compile plugins/platforms/telegram/adapter.py tests/gateway/test_telegram_clarify_buttons.pyuv run --extra dev --extra messaging python -m pytest tests/gateway/test_telegram_clarify_buttons.py tests/gateway/test_telegram_approval_buttons.py tests/gateway/test_telegram_thread_fallback.py tests/gateway/test_telegram_callback_auth_fail_closed.py -q— 39 passedgit diff --checkCloses #78788