Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat(remote runtime): do not resume runtime if not keep_runtime_alive (#6355)

Xingyao Wang1b6e444ecba9
diff --git a/openhands/runtime/impl/remote/remote_runtime.py b/openhands/runtime/impl/remote/remote_runtime.py
index c3a7353aef..3deb7ba408 100644
--- a/openhands/runtime/impl/remote/remote_runtime.py
+++ b/openhands/runtime/impl/remote/remote_runtime.py
@@ -405,8 +405,13 @@ class RemoteRuntime(ActionExecutionClient):
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