My freestyle renders randomly have these glitches in them (circled in red). From what I can tell they appear sometimes where there is geometry in the background that crosses lines in the foregroud - I've highlighted the position of the background lines in yellow in this image to show where they are. To be clear, the geometry in no way intersects, the background object is quite some distance behind the foreground object in 3D space. What could be causing this and how can I fix it?
Edit: Here is a minimal reproduction:
From making this reproduction I learned something. The issue seems to occur when two objects in the background share an edge in the same place. In the example here the "window" is a seperate object aligned to the wall (which has a cut-out hole for the window). Therefore the edges of the window align with the inner edges of the cutout. If an object is then placed in the foreground the freestyle glitch occurs: