You have to disable depth writes for your bounding boxes, since you don’t want their depth value to be stored in the depth buffer - you only want the box to be tested to see if any values would be visible. Disable depth writing for your bounding box in a similar way to color writing:
glDepthMask(GL_FALSE);
AFAICT, it isn’t the bounding boxes that are being drawn to the color buffer, but the terrain that isn’t being drawn in that position due to your bounding box having already written a nearer depth value to the depth buffer, so the sky is visible through it.