Skip to content

Commit 1b6e444

Browse files
xingyaowwrbren
andauthored
feat(remote runtime): do not resume runtime if not keep_runtime_alive (#6355)
Co-authored-by: Robert Brennan <[email protected]>
1 parent 2b04ee2 commit 1b6e444

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

openhands/runtime/impl/remote/remote_runtime.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,13 @@ def _send_action_server_request(self, method, url, **kwargs):
405405
f'Runtime is temporarily unavailable. This may be due to a restart or network issue, please try again. Original error: {e}'
406406
) from e
407407
elif e.response.status_code == 503:
408-
self.log('warning', 'Runtime appears to be paused. Resuming...')
409-
self._resume_runtime()
410-
return super()._send_action_server_request(method, url, **kwargs)
408+
if self.config.sandbox.keep_runtime_alive:
409+
self.log('warning', 'Runtime appears to be paused. Resuming...')
410+
self._resume_runtime()
411+
return super()._send_action_server_request(method, url, **kwargs)
412+
else:
413+
raise AgentRuntimeDisconnectedError(
414+
f'Runtime is temporarily unavailable. This may be due to a restart or network issue, please try again. Original error: {e}'
415+
) from e
411416
else:
412417
raise e

0 commit comments

Comments
 (0)