face_g, model_g = nil, nil
Sketchup.active_model.entities.grep(Sketchup::Group).each do |g|
if g.entities.grep(Sketchup::Face).empty?
model_g = g
else
face_g = g
end
end
model_g.entities.intersect_with(true, model_g.transformation, Sketchup.active_model.entities, IDENTITY, false, face_g)
The corners of the wall at the right end of the view you showed are not at the same red axis coordinate of the left end of the wall. That can lead to some issues like this.
I moved the corners into place, see if this shows less issues.