Repository navigation
fix(telegram): answer callback queries before sequentialize delays them - #92800
vincentkoc merged 2 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 13, 2026, 6:39 PM ET / 22:39 UTC. Summary PR surface: Source +12. Total +12 across 1 file. Reproducibility: yes. source-reproducible: current main registers Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the pre-sequentialize acknowledgement shape, but mark successful early acknowledgements and skip the handler-level fallback before merging, with focused regression coverage and redacted live Telegram proof. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main registers Is this the best way to solve the issue? No for this branch as written. Pre-sequentialize acknowledgement is the right layer, but the branch should also prevent the downstream duplicate answer and supply live Telegram proof before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2f57352eaa66. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +12. Total +12 across 1 file. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs for an inline model button press while a chat turn was pending.
Motion-trimmed clips: |
Telegram has a ~15s server-side timeout for answerCallbackQuery. When an agent turn is already processing for the same chat/topic, grammY's sequentialize middleware queues the callback update. By the time the callback_query handler runs and calls answerCallbackQuery, the timeout has expired and the user sees a stuck loading spinner on the button. Answer the callback query in a middleware registered before sequentialize so the response is immediate regardless of queue depth. The existing answer in the callback_query handler is idempotent and remains as a fallback. Fixes openclaw#42156
6cb7237 to
999a1e8
Compare
|
Maintainer fixup pushed and ready to land. What changed:
Proof:
Proof gap:
Source SHA: 999a1e8 |




Summary
Telegram callback queries (inline button presses) have a ~15s server-side timeout for
answerCallbackQuery. When an agent turn is already processing for the same chat/topic, grammY'ssequentializemiddleware queues the callback update. By the time thecallback_queryhandler runs and callsanswerCallbackQuery, the timeout has expired and the user sees a stuck loading spinner on the button.The fix adds a middleware registered before
sequentializethat answers callback queries immediately, bypassing the queue. The existing answer in thecallback_queryhandler is idempotent and remains as a fallback.Root cause
In
extensions/telegram/src/bot-core.ts, the middleware stack order is:updateTracker(line 216)sequentialize(line 252) — queues updates by chat/topic keycallback_queryhandler (registered viaregisterTelegramHandlersat line 429) — callsanswerCallbackQueryWhen an agent turn is processing for chat X,
sequentializequeues all subsequent updates for chat X — including callback queries. TheanswerCallbackQuerycall inside the handler is delayed until the agent turn completes, often exceeding Telegram's 15s timeout.Fix
Add a
bot.use()middleware beforesequentialize(line 252) that detects callback queries and answers them immediately via fire-and-forgetbot.api.answerCallbackQuery(callback.id). This runs before the queue, so the answer reaches Telegram within the timeout window regardless of agent turn duration.1 file changed, 12 insertions(+).
Real behavior proof
upstream/main(commit 6cb72371)sequentializeviagrep -nnode scripts/run-vitest.mjs run extensions/telegram/src/bot-handlers.runtime.test.ts— 4/4 passednode scripts/run-vitest.mjs run extensions/telegram/src/bot.test.ts— 77/77 passedpnpm build— succeededbot.create-telegram-bot.test.tsare unrelated — confirmed by running the same tests on upstream/main without the change).