Verse: nested race block not cancelling properly

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

In some situations, it appears to be possible for code in a ‘race’ block to continue executing after it has been cancelled
It is happening in some combination of nested sync and race blocks.

Steps to Reproduce

1: Create a new Verse file called test_device.verse
2: Paste this code into the Verse file:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

test_device := class(creative_device):
    OnBegin<override>()<suspends>:void=
        Sleep(1.0)
        TestEvent : event() = event(){}
        sync:
            block:
                Sleep(5.0)
                TestEvent.Signal()
                Sleep(Inf)
            block:
                Print("Starting race")
                race:
                    block:
                        TestEvent.Await()
                        Print("Got TestEvent")
                    loop:
                        Print("PING")
                        race:
                            Sleep(1.0)
                            Sleep(2.0)
                Print("Finished race")

3: Create an instance of this device in the map and launch it
4: Observe the output

Expected Result

I would expect the following output:
LogVerse: : Starting race
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : Got TestEvent
LogVerse: : Finished race

Observed Result

I get the following output:
LogVerse: : Starting race
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : Got TestEvent
LogVerse: : Finished race
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING
LogVerse: : PING

Platform(s)

Windows PC

Additional Notes

The “ping” loop is properly cancelled if the Print(“PING”) line is followed by a single sleep instead of a race with 2 sleeps.
It also works if the Sleep(Inf) is removed, allowing the sync block to complete.