fix: send error details to user in gateway outer exception handler#1966
Merged
fix: send error details to user in gateway outer exception handler#1966
Conversation
Previously, if an error occurred during response processing in _process_message_background (e.g. during extract_media, send, or any uncaught exception from the handler), the error was only logged to server console and the user was left with radio silence — typing indicator stops but no message arrives. Now the outer except block attempts to send the error type and detail (truncated to 300 chars) to the user's chat, matching the format already used by the inner handler in gateway/run.py.
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
When an error occurs during response processing in
_process_message_background(the outer try/except ingateway/platforms/base.py), the error was only logged to server console viaprint()+traceback.print_exc(). The user saw the typing indicator stop but received no message — radio silence.This was reported by a Telegram user who kept getting silent failures with no way to diagnose what was wrong.
What changed
The outer
exceptblock in_process_message_background()now attempts to send the error type and detail (truncated to 300 chars) to the user's chat, matching the error format already used by the inner handler ingateway/run.py.The send attempt is wrapped in its own try/except so if even error reporting fails, it won't crash the handler.
Why two layers?
gateway/run.py:2119): Catches agent/API errors during_handle_message()— already returns error details to user. Works well.base.py:1098): Catches errors during response delivery (extract_media, send, image routing, etc.) or anything that escapes the inner handler. Previously silent. Now fixed.Test plan