codeBlock.data is read-only, this is why code1.data.test2 = false is failing silently. It doesn't change the value. What I meant was to reference code1.data.test2 (index returned) on an error handler or another block with the goal of running a new loop, using the index to reference where to start.
However, @explore recently shared a way to trigger Workflows recursively. Maybe this is an easier implementation for your use case:
Feel free to share a screenshot of your WF, it would help us figure out the next steps.