Help with algorithm

Heya! I have been working on an A* algorithm for the past 2 or more days and here is what I have achieved:

As you can see, it is able to handle ladders and stairs with ease and is undoubtedly BETTER than roblox’s stupid pathfinding. Though, it is quite laggy. But that’s not my question. My question is that how can I make it not do this:

As you can see, a simple 3 stud cut can put an end to it’s reign and make it crash my brand new computer with it.


How can I make it traverse simple cuts in parts and do simple parkour?

As this is an idea related question so it does not require any code to be given. But just in case here it is:

local function CreateNodes(startNode)
	for _,direction in pairs(Directions) do
		local endPos = startNode.Position + direction * spacing
		local ray = Blockcast(startNode.Position,direction)
		local ray2 = Raycast(startNode.Position+Vector3.yAxis*5,direction)
		local topRay = Raycast(endPos+Vector3.yAxis*7,-Vector3.yAxis*100)
		local upRay = Raycast(topRay.Position,Vector3.yAxis*3)
		local condition = false
		local condition2 = false
		local trussTop =
		local isTruss = false
		if ray and not ray2 then
			condition = true
		elseif not ray then
			condition = true
		elseif ray and ray2 and ray.Instance:FindFirstChild("Climbable") then
			local height = (ray.Instance.Position - ray.Position).Y + ray.Instance.Size.Y/2
			isTruss = true
			trussTop = ray.Position+Vector3.yAxis*height
		if topRay.Instance:IsDescendantOf(workspace.Nodes) then condition = false end
		if condition and not upRay then
		elseif not condition and ray and ray.Instance:IsDescendantOf(workspace.Nodes) and not upRay then
		endPos = isTruss and trussTop or topRay.Position
		local distance,closestNode = FindClosestTo(endPos)
		if condition and not upRay or isTruss and distance >= spacing then
			local part = MakeNode()
			part.Position = endPos
			local node = {
				Position = endPos,
				Parent = startNode,
				G = startNode.G + 1,
				Node = part

This is where all the rules are assigned and so if I want to detect parts then it should be done here.