Skip to content

Fix: timer created inside wait/pause/ask/menu callback never fires#1835

Merged
alexwarren merged 1 commit into
mainfrom
fix/timer-not-rescheduled-after-wait-callback
Jul 8, 2026
Merged

Fix: timer created inside wait/pause/ask/menu callback never fires#1835
alexwarren merged 1 commit into
mainfrom
fix/timer-not-rescheduled-after-wait-callback

Conversation

@alexwarren

Copy link
Copy Markdown
Contributor

Summary

  • A user reported a game (using a 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.
  • Root cause: FinishWait, FinishPause, SetQuestionResponse, and SetMenuResponse in WorldModel never called SendNextTimerRequest() after running their callback script, unlike every other turn-ending path (SendCommand, Tick, SendEventCore, BeginInternalAsync). WebPlayer/WasmPlayer rely on the RequestNextTimerTick event to know when to next poll the engine for elapsed timers — a timer created during one of these callbacks (e.g. via the SetTimeout core 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.
  • Fix: call SendNextTimerRequest() at the end of all four methods, matching the existing pattern elsewhere in the file.

Test plan

  • Added Wait_CallbackCreatesTimer_RequestsNextTimerTick regression test (tests/EngineTests/CallbackTests.cs) plus a testwaittimer fixture command, asserting the host is notified via RequestNextTimerTick after a wait callback creates a timer.
  • Verified the new test fails without the fix and passes with it.
  • dotnet test — all 318 tests across every test project pass.
  • Full solution build succeeds.

🤖 Generated with Claude Code

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>
@alexwarren alexwarren merged commit 257bcda into main Jul 8, 2026
3 checks passed
@alexwarren alexwarren deleted the fix/timer-not-rescheduled-after-wait-callback branch July 8, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant