Skip to content

fix(telegram): restore 2×2 exec-approval button layout - #70912

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/70615-telegram-approval-2x2
Jul 25, 2026
Merged

fix(telegram): restore 2×2 exec-approval button layout#70912
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/70615-telegram-approval-2x2

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Exec-approval buttons on Telegram were flattened into a single 4-button row after the smart-deny conditional keyboard change (d48bf74), truncating labels on mobile. This pairs them into rows of 2, restoring the readable 2×2 grid.

Root cause: commit d48bf74 refactored the hardcoded 2×2 keyboard into a dynamic buttons list but wrapped it as InlineKeyboardMarkup([buttons]) — one single row instead of the original 2×2 layout.

Changes

  • plugins/platforms/telegram/adapter.py: Replace InlineKeyboardMarkup([buttons]) with InlineKeyboardMarkup([buttons[i:i+2] for i in range(0, len(buttons), 2)]) — pairs buttons into rows of 2, matching the existing send_choice_picker convention.
  • tests/gateway/test_telegram_approval_buttons.py: Regression tests for 4-button (2×2), 3-button (2+1), and 2-button smart_deny (1×2) row layouts.

Validation

Before After
Button layout 1 row × 4 buttons (truncated) 2 rows × 2 buttons (readable)
Tests 25 passed 26 passed
Ruff clean clean

Salvage of #70615 by @HexLab98 — contributor commits cherry-picked with authorship preserved. Added one follow-up test for the 2-button smart_deny row-structure case.

Closes #70615

HexLab98 and others added 3 commits July 24, 2026 23:00
Pair conditional approval buttons into rows of two so the full Allow Once /
Session / Always / Deny set stays readable instead of one truncated 4x1 row.
Assert the full set renders as 2x2 and the three-button case keeps Deny on
its own second row.
Follow-up for salvaged PR NousResearch#70615 — the 2-button smart_deny case
(Allow Once + Deny only) was exercised by an existing test but only
at the flat-label level, not asserting the row pairing. Adds the
missing row-structure assertion using the same capture pattern as
the 4-button and 3-button tests.
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/telegram Telegram bot adapter P3 Low — cosmetic, nice to have labels Jul 24, 2026
@kshitijk4poor
kshitijk4poor force-pushed the salvage/70615-telegram-approval-2x2 branch from 65a4b0e to d6d8a87 Compare July 24, 2026 18:18
@galosa

galosa commented Jul 24, 2026

Copy link
Copy Markdown

Confirmed from a real Telegram mobile deployment: the current single-row 4-button layout truncates the labels enough to make the approval scope difficult to distinguish.

Restoring the 2×2 layout is materially clearer on mobile. The dynamic 2-per-row approach here also handles the reduced button sets cleanly. Thanks for preserving the original contributor attribution and adding the regression coverage.

@kshitijk4poor
kshitijk4poor merged commit 6ad632b into NousResearch:main Jul 25, 2026
37 checks passed
@kshitijk4poor
kshitijk4poor deleted the salvage/70615-telegram-approval-2x2 branch August 5, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants