Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extend error handling for the UI #4601

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openhands/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ async def report_error(self, message: str, exception: Exception | None = None):
if exception:
self.state.last_error += f': {exception}'
detail = str(exception) if exception is not None else ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line will send to the chat box the rest of exceptions, and that's actually surprising. For example:
Screenshot 2024-10-29 at 10 41 43

I think the (currently) intended behavior is to not show these, or at least make a generic user-friendly message for them. Or did we really change that intention?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current default behaviour is display errors that are ErrorObservation's (e.g., those called with report_error) and a temporary toast for errors sent directly to the WebSocket such as response errors (e.g., those called with send_error).

Errors like the one in your screenshot probably shouldn't be displayed but only because the developer should handle it in the code (I doubt OpenHands can do something about internal request errors such as these).

In general, it is in my TODO list to display the errors collapsed by default, and probably truncated if they are super long.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, part of the mess right now can be solved if these are not ErrorObs in the first place. OK, cool.


if exception is not None and isinstance(exception, litellm.AuthenticationError):
detail = 'Please check your credentials. Is your API key correct?'
if exception is not None and isinstance(exception, litellm.NotFoundError):
detail = 'The current selected model does not exist or you do not have access to it'
self.event_stream.add_event(
ErrorObservation(f'{message}:{detail}'), EventSource.USER
)
Expand Down
Loading