Repository navigation
refactor(telegram): unify interactive keyboard rendering - #128728
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Mantis Telegram proof — PASSSummary: A real Telegram user exercised the legacy-to-modern keyboard fallback on current main and the pull-request candidate. In both lanes, a legacy control with a 65-byte callback was discarded, the valid modern fallback rendered as the only button, and clicking it ran /status successfully. The recorded Bot API keyboard payloads were identical. This is a behavior-preserving refactor rather than a user-visible bug fix, and the candidate preserves the reported behavior.
Motion-trimmed clips: |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 9:10 AM ET / 13:10 UTC. ClawSweeper reviewWhat this changesThe PR removes Telegram’s private legacy keyboard renderer and routes legacy interactive replies through the Plugin SDK presentation bridge and Telegram’s canonical keyboard renderer. Merge readinessKeep open: current main still has the duplicate legacy Telegram renderer, while this PR replaces it with the shared presentation path without a concrete source-level regression. A completed real Telegram proof and exact-head checks are still needed before merge. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTelegram outbound paths accept explicit keyboards, legacy interactive replies, and portable presentations, then turn the selected controls into inline-keyboard rows for Telegram delivery. The resolver’s precedence and dropped-control reporting affect callback, approval, question, and fallback behavior across send and reply funnels. flowchart LR
A[Outbound reply inputs] --> B[Telegram keyboard resolver]
B --> C{Explicit keyboard present?}
C -->|Yes| D[Inline keyboard rows]
C -->|No| E[Legacy reply bridge]
E --> F[Canonical presentation renderer]
F --> D
D --> G[Telegram delivery funnels]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -26, Tests +49, Other 0. Total +23 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the SDK bridge and single Telegram renderer, then attach a redacted real Telegram result covering explicit keyboards, legacy controls, and unusable-control fallback before landing. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor rather than a report of a current failure; source and focused tests establish the intended precedence and fallback invariants. Is this the best way to solve the issue? Yes: the SDK bridge is type-compatible and lossless for legacy controls, so reusing the canonical renderer is more maintainable than retaining a second Telegram conversion path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 659ca1ed01c2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…8728) * refactor(telegram): unify interactive keyboard rendering * chore(telegram): ratchet removed keyboard assertion


What Problem This Solves
Telegram maintained two separate inline-keyboard renderers for legacy interactive replies and modern message presentations. Both repeated the same button/select conversion and row chunking, leaving callback, approval, and fallback behavior vulnerable to drift.
Why This Change Was Made
Delete the obsolete plugin-private legacy renderer and reuse the existing Plugin SDK legacy-to-presentation bridge together with Telegram's canonical presentation renderer. Explicit keyboards still retain exact reference identity and short-circuit before lower-priority payloads are inspected. Legacy payloads are normalized once; text-only or entirely discarded legacy controls still fall back to usable presentation buttons, including existing dropped-control notifications.
The canonical renderer remains the sole owner of three-button row ordering, callback byte limits, typed approval/command/question authorization boundaries, opaque callback envelopes, and direct-chat Web App gating. No public API, configuration, SDK export, or security behavior changes.
Production: +10/-36, net -26 lines. Tests: +49 lines for explicit lazy identity and table-driven text-only/oversized-control fallback regressions.
User Impact
Telegram inline keyboards keep their existing visible behavior while a duplicate private rendering path is removed. Existing approval, question, callback, select, Web App, and delivery behavior remains unchanged.
Evidence
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/private/tmp/openclaw-cleanup2-lane6-vitest-cache node scripts/run-vitest.mjs --configLoader runner extensions/telegram/src/button-types.test.ts extensions/telegram/src/inline-buttons.test.ts extensions/telegram/src/interactive-fallback.test.ts extensions/telegram/src/approval-handler.runtime.test.ts extensions/telegram/src/action-runtime.test.ts extensions/telegram/src/outbound-adapter.test.ts extensions/telegram/src/outbound-adapter.presentation.test.ts extensions/telegram/src/outbound-adapter.web-app.test.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/send.test.ts.git diff --check, and exact changed-lane dry-run all pass; two independent source reviews found no issues and structured autoreview reports the patch correct.markdown-ittype, and TUI declaration-generation failures before examining Telegram. Exact-head hosted CI and mandatory repository-nativeOPENCLAW_TESTBOX=1 scripts/pr prepare-runprovide the authoritative clean-environment full gate.