Skip to content

Commit

Permalink
feat(remote runtime): do not resume runtime if not keep_runtime_alive (
Browse files Browse the repository at this point in the history
…#6355)

Co-authored-by: Robert Brennan <[email protected]>
  • Loading branch information
xingyaoww and rbren authored Jan 19, 2025
1 parent 2b04ee2 commit 1b6e444
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions openhands/runtime/impl/remote/remote_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,13 @@ def _send_action_server_request(self, method, url, **kwargs):
f'Runtime is temporarily unavailable. This may be due to a restart or network issue, please try again. Original error: {e}'
) from e
elif e.response.status_code == 503:
self.log('warning', 'Runtime appears to be paused. Resuming...')
self._resume_runtime()
return super()._send_action_server_request(method, url, **kwargs)
if self.config.sandbox.keep_runtime_alive:
self.log('warning', 'Runtime appears to be paused. Resuming...')
self._resume_runtime()
return super()._send_action_server_request(method, url, **kwargs)
else:
raise AgentRuntimeDisconnectedError(
f'Runtime is temporarily unavailable. This may be due to a restart or network issue, please try again. Original error: {e}'
) from e
else:
raise e

0 comments on commit 1b6e444

Please sign in to comment.