File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,21 +154,25 @@ async def process_message(message_data: dict) -> None:
154154
155155 except httpx .TimeoutException :
156156 logger .warning (f"Agent Server timeout for chat_id={ message .chat_id } " )
157+ reply_to_id = _get_reply_to_id (message .message_id , thread_id , message .message_thread_id )
157158 await bot .send_message (
158159 chat_id = message .chat_id ,
159160 text = "Request timed out." ,
160161 message_thread_id = thread_id ,
162+ reply_to_message_id = reply_to_id ,
161163 )
162164 raise # Re-raise to trigger SQS retry for transient errors
163165
164166 except Exception as e :
165167 logger .exception (f"Agent Server error for chat_id={ message .chat_id } " )
166168 error_text = f"Error: { str (e )[:200 ]} "
169+ reply_to_id = _get_reply_to_id (message .message_id , thread_id , message .message_thread_id )
167170 try :
168171 await bot .send_message (
169172 chat_id = message .chat_id ,
170173 text = error_text ,
171174 message_thread_id = thread_id ,
175+ reply_to_message_id = reply_to_id ,
172176 )
173177 except Exception as send_error :
174178 logger .error (f"Failed to send error message to Telegram: { send_error } " )
You can’t perform that action at this time.
0 commit comments