feat: Telegram message reactions for agent lifecycle feedback#436
Open
houko wants to merge 5 commits intoRightNow-AI:mainfrom
Open
feat: Telegram message reactions for agent lifecycle feedback#436houko wants to merge 5 commits intoRightNow-AI:mainfrom
houko wants to merge 5 commits intoRightNow-AI:mainfrom
Conversation
Add emoji reactions on incoming Telegram messages to provide immediate visual feedback while the agent processes the request. Flow: 👀 (received) → 👍 (success) or 👎 (error) Changes: - telegram.rs: add api_set_reaction() calling setMessageReaction API, implement send_reaction() on ChannelAdapter trait, add telegram_reaction_emoji() mapping phases to Telegram-supported emojis - bridge.rs: send queued reaction on message receipt, update to done/error after agent responds Closes RightNow-AI#435 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `status_reactions` config field to TelegramConfig (default: true) so reactions can be disabled via config.toml - Guard api_set_reaction against message_id <= 0 - Truncate error response body in logs to 200 chars - Add TelegramAdapter::with_reactions() constructor - Add tests: disabled reactions no-op, invalid message_id error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add tokio::select! racing in bridge dispatch: show 👀 immediately, switch to 🤔 after 2s if agent is still processing, then 🎉/😱 on completion/error - Change Done emoji from 👍 to 🎉 and Error from 👎 to 😱 for clearer status indication - Update tests to match new emoji mapping Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `message_react` tool so agents can choose their own reaction emoji instead of hardcoded lifecycle emojis - Add `send_channel_reaction()` to KernelHandle trait and implement in kernel - Inject [channel_context] header into messages so agents know channel, recipient, and message_id for the react tool - Remove hardcoded "done" reaction — agent chooses via tool call - Keep hardcoded "error" reaction (agent can't react on failure) - Update bridge integration tests for channel_context header in messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
01668bd to
c57ea27
Compare
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.
Summary
setMessageReactionAPI for real-time emoji-based agent lifecycle feedbackmessage_reacttool so agents can choose their own reaction emoji contextually — no hardcoded "done" emojitokio::select!with biased racing to skip the thinking reaction if agent responds within 2 secondsChanges
crates/openfang-channels/src/telegram.rsapi_set_reaction()method calling Telegram Bot APIsetMessageReactionsend_reaction()onChannelAdaptertrait withstatus_reactionsguardtelegram_reaction_emoji()mapping for lifecycle phases (Queued→👀, Thinking→🤔, Error→😱, etc.)with_reactions()constructor andstatus_reactionsfieldcrates/openfang-channels/src/bridge.rstokio::select!with biased racing[channel_context]header into agent messages with channel, recipient, message_idmessage_reacttoolcrates/openfang-runtime/src/tool_runner.rsmessage_reacttool definition and handlercrates/openfang-runtime/src/kernel_handle.rssend_channel_reaction()method toKernelHandletraitcrates/openfang-kernel/src/kernel.rssend_channel_reaction()— routes through channel adapter'ssend_reaction()crates/openfang-types/src/config.rsstatus_reactions: booltoTelegramConfig(default:true)crates/openfang-api/src/channel_bridge.rsstatus_reactionsconfig flag toTelegramAdapter::with_reactions()Test plan
test_telegram_reaction_emoji_mapping— verifies phase→emoji mappingstest_send_reaction_disabled— no-op whenstatus_reactions=falsetest_send_reaction_invalid_message_id— error on non-numeric message_idtest_builtin_tool_definitions— includesmessage_reacttool[channel_context]headercargo test -p openfang-channels -p openfang-runtime— all tests passCloses #435