Repository navigation
fix(telegram): drop expired approval callbacks - #82388
neeravmakwana wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <[email protected]>
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-level: current main wraps expired approval resolver errors as retryable callback failures, and isolated polling keeps any thrown spooled update for retry. The linked issue also provides concrete Telegram polling-mode steps and logs. Real behavior proof Next step before merge Security Review detailsBest possible solution: Merge the focused callback classification fix once after-fix real Telegram or bot-to-bot proof is added, then let the linked bug close through the PR. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main wraps expired approval resolver errors as retryable callback failures, and isolated polling keeps any thrown spooled update for retry. The linked issue also provides concrete Telegram polling-mode steps and logs. Is this the best way to solve the issue? Yes, the PR's approach is the narrow maintainable fix: classify approval-not-found resolver failures before retry wrapping while preserving generic resolver retries. The remaining blocker is proof quality, not an observed code defect in the diff. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5f85e6b69213. |
This comment was marked as spam.
This comment was marked as spam.
|
Thanks @neeravmakwana for opening the focused fix PR. Your diagnosis was right: stale Telegram exec approval callbacks needed to be classified as handled/non-retryable when the approval resolver reports We ended up landing #82455 as the maintainer fix. It follows the same core direction and adds the target-only fallback guard for legacy plugin approval buttons, so stale approval ids drain without accidentally clearing ambiguous legacy fallback buttons. Closing this PR as superseded by the landed fix in #82455 / merge commit 9162349. Thanks again for moving the issue forward. |
Summary
Root cause
Telegram approval callbacks currently wrap every approval resolver failure in the retryable callback error. When the resolver returns
unknown or expired approval id, polling-mode isolated ingress keeps the persisted spooled update for retry, so the same expired callback can be replayed forever across gateway restarts.Linked issue
Fixes #82347.
Why this is safe
The fix reuses the existing runtime-enforced
isApprovalNotFoundErrorclassifier that other channel approval paths use for expired approvals. It only changes the already-failed stale approval-id path from retryable to handled; transient resolver errors still throw and retry as before.Security/runtime controls unchanged
Telegram sender authorization, exec approval target checks, plugin fallback authorization, approval decisions, and approval resolver policy are unchanged. This does not rely on prompt text; the behavior is gated by the structured/runtime approval-not-found error classifier.
Real behavior proof
Behavior addressed: expired Telegram approval callbacks no longer bubble a retryable handler error after the approval id is gone.
Real environment tested: local OpenClaw source checkout with Telegram plugin unit harness.
Exact steps or command run after this patch:
npm_config_manage_package_manager_versions=false pnpm test extensions/telegram/src/bot.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts -- --reporter=verbose -t "expired approval callbacks|retries exec approval callbacks"Evidence after fix: the focused Telegram shard passed with 2 matching tests, including the new expired approval callback regression and the existing generic resolver retry regression.
Observed result after fix: stale approval callbacks resolve without throwing, acknowledge the callback, clear the inline keyboard, and do not send Telegram chat error messages; generic resolver failures still retry.
What was not tested: live Telegram polling with real credentials was not run in this local pass.
Verification
git diff --check origin/main...HEADnpm_config_manage_package_manager_versions=false pnpm test extensions/telegram/src/bot.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts -- --reporter=verbose -t "expired approval callbacks|retries exec approval callbacks"npm_config_manage_package_manager_versions=false pnpm check:changed(fails on unrelated pre-existing lint inextensions/openrouter/image-generation-provider.ts:typescript(no-redundant-type-constituents)forOpenRouterChatCompletionResponse | unknown; changed-file guards and extension typechecks passed before that lint failure)Out of scope
AI-assisted
Yes.
Made with Cursor