From bcc62bb647d69ed1af82b382101a4f48ff8e8f2f Mon Sep 17 00:00:00 2001 From: marko-kraemer Date: Mon, 7 Jul 2025 20:45:16 +0200 Subject: [PATCH] fix port expose not working --- backend/agent/tools/sb_expose_tool.py | 29 --------------------------- 1 file changed, 29 deletions(-) diff --git a/backend/agent/tools/sb_expose_tool.py b/backend/agent/tools/sb_expose_tool.py index e0e1973b..fa24e4f9 100644 --- a/backend/agent/tools/sb_expose_tool.py +++ b/backend/agent/tools/sb_expose_tool.py @@ -10,30 +10,6 @@ class SandboxExposeTool(SandboxToolsBase): def __init__(self, project_id: str, thread_manager: ThreadManager): super().__init__(project_id, thread_manager) - async def _wait_for_sandbox_services(self, timeout: int = 30) -> bool: - """Wait for sandbox services to be fully started before exposing ports.""" - start_time = time.time() - - while time.time() - start_time < timeout: - try: - # Check if supervisord is running and managing services - result = await self.sandbox.process.exec("supervisorctl status", timeout=10) - - if result.exit_code == 0: - # Check if key services are running - status_output = result.output - if "http_server" in status_output and "RUNNING" in status_output: - return True - - # If services aren't ready, wait a bit - await asyncio.sleep(2) - - except Exception as e: - # If we can't check status, wait a bit and try again - await asyncio.sleep(2) - - return False - @openapi_schema({ "type": "function", "function": { @@ -93,11 +69,6 @@ class SandboxExposeTool(SandboxToolsBase): if not 1 <= port <= 65535: return self.fail_response(f"Invalid port number: {port}. Must be between 1 and 65535.") - # Wait for sandbox services to be ready (especially important for workflows) - services_ready = await self._wait_for_sandbox_services() - if not services_ready: - return self.fail_response(f"Sandbox services are not fully started yet. Please wait a moment and try again, or ensure a service is running on port {port}.") - # Check if something is actually listening on the port (for custom ports) if port not in [6080, 8080, 8003]: # Skip check for known sandbox ports try: