From 321b4e3d0ec558b747c3f74522e0d4b1786e2a2f Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Sat, 30 May 2026 14:20:00 +0200 Subject: [PATCH] fix: recreate tunnel button always creates a new tunnel The previous endpoint blocked recreation if the tunnel was 'healthy' or returned an 'error_response', making the Recreate Tunnel button ineffective in many cases. - apps/api/src/api/tool_instances.py: removed the health-check guards from recreate_tunnel_endpoint. It now unconditionally stops the old tunnel and creates a new one, then commits the new URL to the DB. - Frontend useInstanceActions already calls onRefresh() after success, so the UI updates with the new tunnel URL automatically. Quality gates: ruff clean --- apps/api/src/api/tool_instances.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/apps/api/src/api/tool_instances.py b/apps/api/src/api/tool_instances.py index ee83ed1..0cca5a5 100644 --- a/apps/api/src/api/tool_instances.py +++ b/apps/api/src/api/tool_instances.py @@ -2452,21 +2452,6 @@ async def recreate_tunnel_endpoint( detail="instance must be running to recreate tunnel", ) - # Validate tunnel is actually broken before recreating - if instance.url: - tunnel_health = check_tunnel_health(instance.url) - if tunnel_health["tunnel_status"] == "error_response": - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail=f"Tunnel is working but application returned HTTP {tunnel_health.get('status_code')}. Recreating the tunnel will not fix this issue.", - ) - elif tunnel_health["tunnel_status"] == "healthy": - return { - "status": "healthy", - "url": instance.url, - "message": "Tunnel is already healthy", - } - tool_type = await session.get(ToolType, instance.tool_type_id) if not tool_type: raise HTTPException(