Repository navigation
Conversation
…out backstop (LAB-303) ArenaRunner._sleep was a plain setTimeout. Chrome aligns page timers to 1 s ticks once the tab is hidden or the window is occluded, so on the Bergamo 2P rig (2026-10-16) every host-timed 3 s step ran 4.00 s while the operator worked in ScanImage over the Studio window. The wait now runs on createSleepTimer(): a dedicated Worker built from an inline blob URL (the runner stays a classic <script src> module) arms the timeout and posts back; a page setTimeout is armed beside it as a backstop and whichever fires first wins, so the Worker path is never worse than before. Without Worker / Blob / URL (Node tests) or after a Worker error the setTimeout alone runs. _resolveSleep() clears the handle through the same timer, so stop() / _clear() still wake the wait at once. A wait that overshoots by > 250 ms emits a 'warn' event naming timer throttling, so a starved page shows in the run log. Tests: fallback completes, stop()/_clear() wake a 5 s wait, fake-Worker path (set/clear/backstop/onerror → fallback), the inline Worker source's protocol, late-wait warn, and runSequence with the real sleep (completes; aborts mid-wait). arena_studio.html bumps the runner's ?v= cache-buster. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
4 of 5 tasks
This branch has not been deployed
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
LAB-303 follow-up from the Bergamo ScanImage day (2026-10-16,
ros2-poc/scanimage-day-2026-10-16.mditem 5): host-timed protocol steps ran 4.00 s instead of 3.00 s whenever the Studio window was hidden or covered (the operator working in ScanImage).ArenaRunner._sleepwas a plainsetTimeout, which Chrome aligns to 1 s ticks once a tab is hidden or the window is occluded (and to 1 min after 5 min hidden).js/arena-runner-g6.js:_sleepnow runs oncreateSleepTimer()— a dedicated Worker built from an inline blob URL (no extra file; the runner stays a classic<script src>module per CLAUDE.md) arms the timeout and posts back. A pagesetTimeoutis armed beside it as a backstop; whichever fires first wins, so the Worker path is never worse than the old behavior. WithoutWorker/Blob/URL(Node tests, old engines) or after a Worker error, thesetTimeoutalone runs, exactly as before._resolveSleep()clears through the same timer, sostop()/_clear()/ the runner'sfinallystill wake the wait at once. One Worker per page (sleepTimer()), created on first use.warnevent (host-timed wait ran 4.00 s instead of 3.00 s (browser timer throttling? keep the Studio window visible)) into the run log, so a throttled or starved page is visible in the record, not only in the data afterwards. This is independent of thedocument.hiddenbanner planned for the 2026-10-20 candidate; both can live together.arena_studio.html: bumps the runner's?v=cache-buster (20261018-worker-timer). This one line will conflict trivially with Studio: stop the run when the FicTrac bridge is lost (BRIDGE_LOST) + ?p= links never wait on GitHub (LAB-303 S1, S2) #257's20261015-bridge-lostbump once that lands; keep the newer token.createSleepTimer,sleepTimer,SLEEP_LATE_WARN_MS.ArenaRunnerG6.sleepTimer().kindreads'worker'in a browser and'timeout'in Node — a headless check can assert it.Tier
next candidate (after 2026-10-20), together with #219. No footer/version bump (the release commit does it).
Release notes
Studio
Test plan
pixi run test(61/61 files;tests/test-arena-runner-g6.js553 checks: fallback sleep completes,stop()/_clear()wake a 5 s wait, fake-Worker path set/clear/backstop/onerror → fallback, the inline Worker source's message protocol, late-waitwarn,runSequencewith the real sleep completes and aborts mid-wait)pixi run studio-smoke0 failures, 0 warningsArenaRunnerG6.sleepTimer().kind === 'worker'in DevTools; step intervals 3.0 s (step_timing.py)🤖 Generated with Claude Code