mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
fix: Don't close runtime on error (#6549)
This commit is contained in:
parent
6b243155f4
commit
83724100e5
@ -134,6 +134,10 @@ class Runtime(FileEditRuntimeMixin):
|
||||
self.add_env_vars(self.config.sandbox.runtime_startup_env_vars)
|
||||
|
||||
def close(self) -> None:
|
||||
"""
|
||||
This should only be called by conversation manager or closing the session.
|
||||
If called for instance by error handling, it could prevent recovery.
|
||||
"""
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ -209,7 +213,6 @@ class Runtime(FileEditRuntimeMixin):
|
||||
self.log('error', f'Unexpected error while running action: {error_message}')
|
||||
self.log('error', f'Problematic action: {str(event)}')
|
||||
self.send_error_message(err_id, error_message)
|
||||
self.close()
|
||||
return
|
||||
|
||||
observation._cause = event.id # type: ignore[attr-defined]
|
||||
|
||||
@ -341,8 +341,6 @@ class RemoteRuntime(ActionExecutionClient):
|
||||
f'Runtime (ID={self.runtime_id}) is not yet ready. Status: {pod_status}'
|
||||
)
|
||||
elif pod_status in ('failed', 'unknown', 'crashloopbackoff'):
|
||||
# clean up the runtime
|
||||
self.close()
|
||||
if pod_status == 'crashloopbackoff':
|
||||
raise AgentRuntimeUnavailableError(
|
||||
'Runtime crashed and is being restarted, potentially due to memory usage. Please try again.'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user