Skip to content

fix(bridges): headless tg_send wiring, PermissionRequest handling, /h…#118

Merged
chauncygu merged 1 commit into
mainfrom
fix/headless-bridges-slash-v3
May 11, 2026
Merged

fix(bridges): headless tg_send wiring, PermissionRequest handling, /h…#118
chauncygu merged 1 commit into
mainfrom
fix/headless-bridges-slash-v3

Conversation

@chauncygu
Copy link
Copy Markdown
Contributor

…elp output forwarding

Issue #84 follow-up. Two user-visible bugs in headless/Docker deploys:

  1. Telegram inline-keyboard approval prompts never appeared:

    • _start_headless_bridges never wired session_ctx.tg_send, so ask_input_interactive's tg_send is not None check failed and prompts fell through to invisible terminal input().
    • _headless_run_query never promoted telegram_incoming → in_telegram_turn, so _is_in_tg_turn() returned False mid-run.
    • _headless_run_query ignored PermissionRequest events entirely, leaving event.granted=False so every approval-required tool was silently denied.
  2. /help, /status, /model etc. only sent "✅ /cmd executed." — the actual menu (rendered via print()) went to docker logs instead of the chat. All three bridges (Telegram, Slack, WeChat) had the same shape. Fixed with a stdout/stderr Tee + ANSI strip; the Tee keeps writing to the original stream so docker logs are unaffected.

Also fixed two callback edge cases in bridges/telegram.py:

  • Stale clicks on already-answered/timed-out prompts no longer paint a misleading "✓ Selected: y" confirmation onto the message.
  • Option values containing backticks/asterisks no longer break Markdown parsing in editMessageText (was failing silently).

Tests: +9 regression tests pinning each fix. 118 bridge tests pass.

…elp output forwarding

Issue #84 follow-up. Two user-visible bugs in headless/Docker deploys:

1. Telegram inline-keyboard approval prompts never appeared:
   - _start_headless_bridges never wired session_ctx.tg_send, so
     ask_input_interactive's `tg_send is not None` check failed and
     prompts fell through to invisible terminal input().
   - _headless_run_query never promoted telegram_incoming →
     in_telegram_turn, so _is_in_tg_turn() returned False mid-run.
   - _headless_run_query ignored PermissionRequest events entirely,
     leaving event.granted=False so every approval-required tool
     was silently denied.

2. /help, /status, /model etc. only sent "✅ /cmd executed." — the
   actual menu (rendered via print()) went to docker logs instead of
   the chat. All three bridges (Telegram, Slack, WeChat) had the same
   shape. Fixed with a stdout/stderr Tee + ANSI strip; the Tee keeps
   writing to the original stream so docker logs are unaffected.

Also fixed two callback edge cases in bridges/telegram.py:
- Stale clicks on already-answered/timed-out prompts no longer paint a
  misleading "✓ Selected: y" confirmation onto the message.
- Option values containing backticks/asterisks no longer break
  Markdown parsing in editMessageText (was failing silently).

Tests: +9 regression tests pinning each fix. 118 bridge tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@chauncygu chauncygu merged commit 3453390 into main May 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant