-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Refactor of error handling #4575
Draft
rbren
wants to merge
23
commits into
main
Choose a base branch
from
rb/prevent-event-loop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1dd8c3f
prevent evenstream from looping back on itself
rbren ba3c558
use hasattr
rbren 1b72a89
refactor a bit
rbren ed3d944
revert perms
rbren 57662b6
private method
rbren a7ce34e
async_add_event
rbren d8becc2
remove unnecessary return
rbren d9811b0
stop dropping events while pending_action is set
rbren 47a95f7
remove FatalErrorObservation
rbren d46b712
refactor react_to_error a bit more
rbren f9c283e
fix comments
rbren 1c44fa6
fix test
rbren 3f67ed3
fix test
rbren cdb8066
Merge branch 'main' of github.com:All-Hands-AI/OpenHands into rb/prev…
enyst 6aff381
Update openhands/controller/state/state.py
enyst f67c8d5
fix conflicts - merge branch 'main' of github.com:All-Hands-AI/OpenHa…
enyst b278d45
more invisible conflicts
enyst d19f998
remove fatal observations
rbren 4745cb6
more refactoring
rbren d7fe86d
new react_to_exception
rbren d240775
change up status message plumbing
rbren 9c28805
Update openhands/controller/agent_controller.py
enyst b757831
Update openhands/controller/agent_controller.py
enyst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,8 +214,7 @@ def edit(self, action: FileEditAction) -> Observation: | |
return obs | ||
if not isinstance(obs, FileWriteObservation): | ||
return ErrorObservation( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Use consistent naming for error handling to improve readability. Existing Code: return ErrorObservation(
f'Fatal Runtime in editing: Expected FileWriteObservation, got {type(obs)}: {str(obs)}',
) Improved Code: return ErrorObservation(
f'Error in editing: Expected FileWriteObservation, got {type(obs)}: {str(obs)}',
) Details: |
||
f'Fatal Runtime in editing: Expected FileWriteObservation, got {type(obs)}: {str(obs)}', | ||
fatal=True, | ||
f'Expected FileWriteObservation, got {type(obs)}: {str(obs)}', | ||
) | ||
return FileEditObservation( | ||
content=get_diff('', action.content, action.path), | ||
|
@@ -226,8 +225,7 @@ def edit(self, action: FileEditAction) -> Observation: | |
) | ||
if not isinstance(obs, FileReadObservation): | ||
return ErrorObservation( | ||
f'Fatal Runtime in editing: Expected FileReadObservation, got {type(obs)}: {str(obs)}', | ||
fatal=True, | ||
f'Expected FileReadObservation, got {type(obs)}: {str(obs)}', | ||
) | ||
|
||
original_file_content = obs.content | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is all that's left of this method... it seems we don't really need it, maybe we can set the
agent_state
in the catch block 🤔Is this state ever different than ERROR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one (one...) PAUSED