Repository navigation
feat(notify): answer permission prompts from Telegram - #525
Merged
Merged
Conversation
Notifications were one way: a ping said the agent was blocked on a permission prompt, and the answer still had to be typed at the terminal. With `notify.telegram_control = true` the TUI's permission prompt is also sent to the Telegram chat with Allow / Deny buttons. The first answer wins; the message is then rewritten with the outcome. - Only a button pressed in the configured chat counts, and only for the nonce of the prompt it was sent with. - The key is read from the global config and the environment. A project config cannot set it, and one that changes the bot token or chat id turns control off, so a cloned repository cannot route approvals to its own bot. - Answers go through `<data dir>/telegram-control/<nonce>`, so sessions and processes sharing one bot do not lose each other's button presses. Polling is a short `getUpdates` every 2 s, only while a prompt waits. - The TUI drops a request that was answered remotely and closes its dialog. Deny rules, catastrophic commands and the sandbox are unchanged: the buttons answer the prompt the y/n keys answer. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ssage id Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ble block The tool name in the title is inline code and the detail (the command) is a pre block, which the chat copies with one tap. Entities, not a parse mode, so nothing in a command needs escaping. Co-Authored-By: Claude Fable 5.2 <[email protected]>
A failed send put the full URL in the error, and the error in the logs. The URL carries the Telegram bot token or the Discord webhook secret. Co-Authored-By: Claude Fable 5.2 <[email protected]>
mrnasil
marked this pull request as ready for review
December 2, 2026 14:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Notifications were one way: a ping said the agent was blocked on a permission prompt, and the answer still had to be typed at the terminal.
With
notify.telegram_control = true, a permission prompt in the TUI is also sent to the Telegram chat with Allow / Deny buttons. The first answer wins (terminal or Telegram), and the message is rewritten with the outcome.Safety
y/nkeys answer.denyrules, catastrophic commands and the sandbox are unchanged.How
crates/plugin/src/remote.rs: send the prompt, short-pollgetUpdates(every 2 s, only while a prompt waits), record each answer in<data dir>/telegram-control/<nonce>. Sessions and processes sharing one bot read their answer from that file, whoever polled it.ChannelPermissionPrompter::with_remote: races the UI's answer against aRemoteApprover.Not covered:
questionprompts,--plain, headless runs, sessions attached to a daemon.Verification
cargo testfor config, plugin, agent (--lib) and the TUI run loop: green on Windows and on Linux (WSL).Not verified yet
No run against the real Telegram Bot API. Before merging, with a real bot: turn the key on, trigger a permission prompt, press Allow on the phone, and check the tool runs and the dialog closes; then answer one at the terminal and check the message says so.
🤖 Generated with Claude Code