The problem here is if you're stepping across this ray through these cells, you first arrive at the gray shaded cell. When you ask what primitives overlap, we see that the blue triangle overlaps here. You can do a ray intersection test for this triangle and be able to find the intersection. But the intersection is not in the current cell! And in the next cell there is a closest intersection on the black triangle. You need to wait until you find an intersection in the region of space you are currently observing.