Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add logging when sandbox is assigned to conversation (#13143)

Graham Neubig01ef87aaaa35
diff --git a/openhands/app_server/app_conversation/live_status_app_conversation_service.py b/openhands/app_server/app_conversation/live_status_app_conversation_service.py
index 83abb472c3..32cb6b607b 100644
--- a/openhands/app_server/app_conversation/live_status_app_conversation_service.py
+++ b/openhands/app_server/app_conversation/live_status_app_conversation_service.py
@@ -518,6 +518,17 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
# Update the listener with sandbox info
task.status = AppConversationStartTaskStatus.WAITING_FOR_SANDBOX
task.sandbox_id = sandbox.id
+
+ # Log sandbox assignment for observability
+ conversation_id_str = (
+ str(task.request.conversation_id)
+ if task.request.conversation_id is not None
+ else 'unknown'
+ )
+ _logger.info(
+ f'Assigned sandbox {sandbox.id} to conversation {conversation_id_str}'
+ )
+
yield task
# Resume if paused
diff --git a/openhands/app_server/sandbox/remote_sandbox_service.py b/openhands/app_server/sandbox/remote_sandbox_service.py
index 48fc5560da..400c044fce 100644
--- a/openhands/app_server/sandbox/remote_sandbox_service.py
+++ b/openhands/app_server/sandbox/remote_sandbox_service.py
@@ -515,6 +515,10 @@ class RemoteSandboxService(SandboxService):
# Hack - result doesn't contain this
runtime_data['pod_status'] = 'pending'
+ # Log runtime assignment for observability
+ runtime_id = runtime_data.get('runtime_id', 'unknown')
+ _logger.info(f'Started sandbox {sandbox_id} with runtime_id={runtime_id}')
+
return self._to_sandbox_info(stored_sandbox, runtime_data)
except httpx.HTTPError as e: