Skip to content

Commit

Permalink
fix: Use _send_action_server_request in send_action_for_execution
Browse files Browse the repository at this point in the history
This ensures that all requests go through the proper error handling path,
including the 502 error handling that converts the error to a more helpful
AgentRuntimeDisconnectedError message.
  • Loading branch information
openhands-agent committed Jan 1, 2025
1 parent fa13578 commit 623a6b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openhands/runtime/impl/remote/remote_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def _wait_until_alive_impl(self):
# clean up the runtime
self.close()
raise AgentRuntimeUnavailableError(
f'Runtime (ID={self.runtime_id}) failed to start. Current status: {pod_status}. Pod Logs:\n{runtime_data.get("pod_logs", "N/A")}'
'Runtime became unresponsive and was rebooted, potentially due to memory usage. Please try again.'
)
else:
# Maybe this should be a hard failure, but passing through in case the API changes
Expand Down Expand Up @@ -370,7 +370,7 @@ def _send_action_server_request(self, method, url, **kwargs):
except RequestHTTPError as e:
if e.response.status_code in (404, 502):
raise AgentRuntimeDisconnectedError(
f'{e.response.status_code} error while connecting to {self.runtime_url}'
'Runtime became unresponsive and was rebooted, potentially due to memory usage. Please try again.'
) from e
elif e.response.status_code == 503:
self.log('warning', 'Runtime appears to be paused. Resuming...')
Expand Down

0 comments on commit 623a6b1

Please sign in to comment.