Wasnt clear to me what you were trying to do with he phase poll, if anything. So now I gather you are trying to use it to stop recording when a single period is captured

Without auditing I can say that this won’t really work, the polling mechanism is not designed to work with this time granularity, it is an OSC message that is sent only on audio block boundaries, and only if the “logical phase” has changed modulo the specified quantum. (By logical phase I mean the actual phase of whichever r/w head is active / not presently fading out.) Think about what it means that you have not set the quantum to be strictly less than the loop period.

I would just modulate rec_level manually or with some small delay in Lua. A “record once” function has been implemented but not yet in main branch. I don’t think it will matter much for your application (I’ve been happy with manual control in such applications in the past.) Digging into this further in a different environment would let you do other stuff to make the wavetable.sound “good”, like shift/stretch the cycle capture window to match zero crossings / cross correlation, bandlikit the captured cycle, etc.