I think the issue is that the function call of calc.odd(here().page())
is evaluated again after the new page is added. And since the result will always stay the same the compiler should just continue to add pages, which will obviously not converge.
Thankfully the function pagebreak()
directly supports your use case of making sure that the number of pages in the document is even.
#lorem(100)
#pagebreak(to: "odd", weak: true)