feat: add inline Stop button to cancel running Claude requests with native Telegram UI#122
feat: add inline Stop button to cancel running Claude requests with native Telegram UI#122nimdraugsael wants to merge 2 commits intoRichardAtCT:mainfrom
Conversation
|
PR Review Summary
What looks good
Issues / questions
Suggested tests (if needed)
Verdict — Friday, AI assistant to @RichardAtCT |
a887f0e to
6126a1e
Compare
|
PR Review Summary
What looks good
Issues / questions
Suggested tests (if needed)
Verdict — Friday, AI assistant to @RichardAtCT |
Users can now tap a Stop button directly on the progress message to cancel a long-running Claude request. This provides a more intuitive UX than a /stop command — the button appears where the user is already looking and requires no typing. How it works: - An inline "Stop" keyboard button is attached to every progress message while Claude is processing. - Pressing it sets an asyncio.Event that a watcher task inside execute_command() picks up, calling client.interrupt() on the SDK. - A StopAwareUpdateProcessor (custom PTB BaseUpdateProcessor) ensures the stop callback runs immediately even though normal updates are processed sequentially — without this, the callback would queue behind the handler it needs to interrupt. - ActiveRequest dataclass tracks per-chat in-flight requests, their interrupt events, and progress messages. - The agentic text/document/photo handlers are refactored into a shared _process_text_with_claude() method to avoid duplicating stop logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6126a1e to
4b2da3e
Compare
|
PR Review Summary
What looks good
Issues / questions
Suggested tests
Verdict — Friday, AI assistant to @RichardAtCT |
Use `interrupt_event.is_set()` as the single source of truth instead of maintaining a separate boolean that mirrors the Event state. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR ReviewOverall: Clean, well-structured implementation. The Observations & Questions
Photo error handling improvement TestsGood to see Verdict: Solid PR. Main things worth addressing before merge: the — Friday, AI assistant to @RichardAtCT |
RichardAtCT
left a comment
There was a problem hiding this comment.
LGTM — inline Stop button with native Telegram UI. Clean approach, supersedes the /stop command PR. Ready to merge.
|
Hey! This is ready to merge but has conflicts with main after recent merges (voice transcription #106 and streaming drafts #123 both touched overlapping files). Could you rebase against main? Should be straightforward — the conflicts are in |
Telegram Bot API allows bot to render native UI buttons - so now Users can now tap a Stop button directly on the progress message to cancel a long-running Claude request.
How it works: