A bit sleep could do wonder fixed the script again (hopefully for the last time). Now the interactive version passes these tests:
Main problem was that i was changing data in the app handlers. Should have known. Maybe i did a bit to much geometry-nodes lately and to less scripting.
Updated script above again to the newest version.