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
This commit is contained in:
2026-05-30 14:20:00 +02:00
parent 2e156fc534
commit 321b4e3d0e
-15
View File
@@ -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(