Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix: clean up reaction on all exception paths in message_handler

yh cfaf04da29769
diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.py
index c17b417a2..18723ea46 100644
--- a/core/handlers/message_handler.py
+++ b/core/handlers/message_handler.py
@@ -236,6 +236,25 @@ class MessageHandler:
await self._delete_ack(context.channel_id, request)
except Exception as e:
logger.error(f"Error processing user message: {e}", exc_info=True)
+ # Clean up reaction on any exception
+ # Use try/except to safely access possibly-unbound local variables
+ try:
+ try:
+ # Try using request object if it was created
+ if request.ack_reaction_message_id: # type: ignore[possibly-undefined]
+ await self._remove_ack_reaction(context, request) # type: ignore[possibly-undefined]
+ except NameError:
+ # request not defined yet, try using local variables
+ if (
+ ack_reaction_message_id # type: ignore[possibly-undefined]
+ and ack_reaction_emoji # type: ignore[possibly-undefined]
+ and not subagent_name # type: ignore[possibly-undefined]
+ ):
+ await self.im_client.remove_reaction(
+ context, ack_reaction_message_id, ack_reaction_emoji
+ )
+ except Exception as cleanup_err:
+ logger.debug(f"Failed to clean up reaction on error: {cleanup_err}")
await self.im_client.send_message(
context, self.formatter.format_error(f"Error: {str(e)}")
)