fix: Don't close runtime on error (#6549)

This commit is contained in:
Ray Myers 2025-01-30 13:09:24 -06:00 committed by GitHub
parent 6b243155f4
commit 83724100e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -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]

View File

@ -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.'