#19829: fix(telegram): fall back to default scope for array capabilities without inlinebuttons
channel: telegram
size: S
Cluster:
Telegram Inline Button Enhancements
## Problem
Fixes #19797
When `channels.telegram.capabilities` is configured as a **legacy array** that does **not** include `"inlinebuttons"`, the `resolveInlineButtonsScopeFromCapabilities` function returned `"off"` — silently disabling all `callback_query` handling.
Users would see styled inline buttons in Telegram (buttons were sent correctly) but pressing them had no effect because the callback handler returned early after calling `answerCallbackQuery`.
**Affected configurations:**
- `capabilities: []` — empty array
- `capabilities: ["someOtherFeature"]` — array without `inlinebuttons`
The `undefined`-capabilities path already returned the correct default (`"allowlist"`), making this an inconsistency between the two paths.
## Fix
Return `DEFAULT_INLINE_BUTTONS_SCOPE` (`"allowlist"`) instead of `"off"` when the capabilities array does not contain `"inlinebuttons"`.
**Backward-compatible:**
- `capabilities: ["inlineButtons"]` → still maps to `"all"` ✓
- `capabilities: { inlineButtons: "off" }` → still explicit opt-out preserved ✓
- `capabilities: undefined` → still `"allowlist"` ✓
## Files changed
- `src/telegram/inline-buttons.ts`: one-line fix replacing `"off"` with `DEFAULT_INLINE_BUTTONS_SCOPE`
- `src/telegram/inline-buttons.test.ts`: added `resolveTelegramInlineButtonsScope` and `isTelegramInlineButtonsEnabled` suites (10 new tests)
## Test evidence
```
✓ src/telegram/inline-buttons.test.ts (15 tests) 4ms
✓ src/telegram/bot.test.ts (31 tests) 67ms
Test Files 2 passed (2)
Tests 46 passed (46)
```
Full Telegram suite:
```
Test Files 39 passed (39)
Tests 486 passed (486)
```
pnpm build ✅ pnpm check ✅
> [!NOTE]
> This fix was authored with AI assistance (OpenClaw autonomous contributor).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes a regression where legacy array-format `capabilities` without `"inlinebuttons"` (e.g., `[]` or `["otherFeature"]`) resolved to scope `"off"`, silently disabling all Telegram inline button callback handling. Buttons were still rendered but pressing them had no effect. The fix returns `DEFAULT_INLINE_BUTTONS_SCOPE` (`"allowlist"`) instead, matching the existing behavior for `undefined` capabilities.
- One-line fix in `resolveInlineButtonsScopeFromCapabilities` replaces `"off"` with `DEFAULT_INLINE_BUTTONS_SCOPE` for the legacy array fallback path
- 10 new tests added covering `resolveTelegramInlineButtonsScope` and `isTelegramInlineButtonsEnabled` across all capability formats, including explicit regression cases
- Backward-compatible: explicit opt-out via `{ inlineButtons: "off" }` still works; `["inlineButtons"]` still maps to `"all"`
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it's a minimal, well-tested one-line bug fix with no behavioral changes to existing valid configurations.
- The change is a single-line fix in a pure function that aligns the legacy array fallback with the existing default behavior. All existing capability formats (explicit opt-out via object, explicit opt-in via array, undefined) retain their behavior. 10 new tests validate the fix and cover regression scenarios. The change is backward-compatible and has clear justification.
- No files require special attention.
<sub>Last reviewed commit: 7e3cae2</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22095: feat: add Telegram inline buttons to exec approval requests
by AIflow-Labs · 2026-02-20
79.0%
#19213: Telegram: preserve DM topic thread in direct replies
by Kemalau · 2026-02-17
77.4%
#23238: fix(telegram): account named "default" silently breaks inbound polling
by anillBhoi · 2026-02-22
77.4%
#16102: Fix: Telegram Inline Button Support for Exec Approvals (builds on #...
by RoguePhoenix117 · 2026-02-14
76.7%
#21271: fix(commands): pass channel/capabilities/shell/os to runtime in com...
by evansantos · 2026-02-19
76.3%
#14359: fix: prefer named Telegram account over orphan 'default' in binding...
by itsGustav · 2026-02-12
76.3%
#17070: fix(telegram): Outbound: ignore empty legacy target fields
by yhw2003 · 2026-02-15
75.4%
#14549: feat(telegram): add support for URL-type inline buttons
by kokosthief · 2026-02-12
75.4%
#19991: feat(telegram): callback direct mode with dedupe, button state, and...
by li-yifei · 2026-02-18
75.2%
#21898: fix(telegram): auto-detect captionable messages for editMessageCaption
by ptrkstr · 2026-02-20
75.2%