Skip to content

Interactive Button-based Telegram Session Resume UI Improvements - #33702

Closed
indigokarasu wants to merge 3 commits into
NousResearch:mainfrom
indigokarasu:feat/telegram-resume-ui-v2
Closed

Interactive Button-based Telegram Session Resume UI Improvements#33702
indigokarasu wants to merge 3 commits into
NousResearch:mainfrom
indigokarasu:feat/telegram-resume-ui-v2

Conversation

@indigokarasu

Copy link
Copy Markdown
Contributor

Summary

Replaces the plain-text /resume list on Telegram with an inline keyboard showing the last 12 non-cron named sessions sorted by recency.

Changes

  • gateway/platforms/telegram.py: Intercept /resume with no args in _handle_command, send inline keyboard via new _send_resume_button_ui() method. Handle rs:<session_id> callback to dispatch synthetic /resume event.
  • gateway/run.py: New get_resume_sessions() method returns structured session data. Fetches from all platforms, excludes cron/tool, filters for titled sessions, stops at 12.
  • tests/gateway/test_telegram_resume_button_ui.py: 13 new tests covering interception, button UI, callback handling, auth, and session listing.

UX

  • Numbered list (1-12) in message body with title + preview
  • Matching numbered buttons (truncated to fit mobile ~25 chars)
  • Plain text (no parse mode) — avoids Telegram HTML/Markdown escaping issues with session titles
  • Sessions sorted by most recent activity
  • Fallback: /resume or /resume still works through normal gateway handling
  • link previews disabled on resume UI messages

Test Results

  • 13 new tests: all passing ✅
  • 2635 existing gateway tests: 2635 passing, 1 pre-existing failure (MS Graph webhook trio test, unrelated)

…parse errors

Telegram's HTML parser chokes on common characters like '.' and '-' in
session titles (e.g. 'MCP Server', 'api-keys'). Switch from ParseMode.HTML
to plain text with no parse mode. Use numbered list with indented previews.

Also re-applies changes from feat/telegram-resume-button-ui which was lost
during a repo rebase.
- Button title truncated to ~40 chars (was 18) to use full mobile width
- disable_web_page_preview=True to suppress link previews in body text
- 13 tests covering interception, button UI, callback handling, auth, and session listing
- Tests verify: /resume with no args triggers button UI, /resume with args falls through,
  keyboard has correct buttons, labels are truncated, previews included, fallback messages,
  unauthorized users denied, callback routing, and get_resume_sessions behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants