Fix: timer created inside wait/pause/ask/menu callback never fires#1835
Merged
Merged
Conversation
Timers created inside a wait/pause/ask/menu callback (e.g. via SetTimeout) never fired on WebPlayer/WasmPlayer, because FinishWait, FinishPause, SetQuestionResponse, and SetMenuResponse didn't call SendNextTimerRequest() after running their callback script, unlike every other turn-ending path (SendCommand, Tick, SendEventCore, BeginInternalAsync). Those two players rely on the RequestNextTimerTick event to know when to schedule their next check, so a timer created mid-callback was silently never scheduled. The Quest 5 desktop player isn't affected since it polls its own clock instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wait { SetTimeout(8) { wait { Ask(...) } } }pattern) that works on the Quest 5 desktop player but hangs forever on WebPlayer and WasmPlayer after the initial "Continue" prompt.FinishWait,FinishPause,SetQuestionResponse, andSetMenuResponseinWorldModelnever calledSendNextTimerRequest()after running their callback script, unlike every other turn-ending path (SendCommand,Tick,SendEventCore,BeginInternalAsync). WebPlayer/WasmPlayer rely on theRequestNextTimerTickevent to know when to next poll the engine for elapsed timers — a timer created during one of these callbacks (e.g. via theSetTimeoutcore function) was never scheduled, so it silently never ran. The desktop player isn't affected because it polls its own clock instead of relying on this push event.SendNextTimerRequest()at the end of all four methods, matching the existing pattern elsewhere in the file.Test plan
Wait_CallbackCreatesTimer_RequestsNextTimerTickregression test (tests/EngineTests/CallbackTests.cs) plus atestwaittimerfixture command, asserting the host is notified viaRequestNextTimerTickafter a wait callback creates a timer.dotnet test— all 318 tests across every test project pass.🤖 Generated with Claude Code