The issue is that edges = entities.add_edges [[30,0,10], [50,0,10], [50,0,30], [30,0,30], [30,0,10]] doesn't weld the start and end point. Therefore there are two vertices at the same 3d point that isn't welded. add_face(edges) require the edges to form a closed loop - the edges you have in this case just looks to be closed.
It's unexpected, I agree, but changing the behaviour now might break existing extensions.
But any reason for first creating edges and then creating the face from the edges instead of just creating the face with the points directly?