Fix: Add timeout safety valve to phrase stabilization polling#106
Fix: Add timeout safety valve to phrase stabilization polling#106cmorten merged 3 commits intoguidepup:mainfrom
Conversation
|
@what-name apologies for stepping on toes - I've updated the I've added a couple of non-golden path tests, not super thorough, but hopefully hints at the scenario and prevents regression. Really appreciate the detailed description and thought/testing gone into this! |
|
Hey, sorry for the late response @cmorten and thanks for adding the tests! Looks good imo Quick heads up though; I've been running guidepup a lot for an AI agent doing accessibility testing, and noticed the polling loop can cause screen recording frame drops. looks like each Thanks for Guidepup! edit: the checks failing is interesting, it says "unable to activate chrome". not sure why tbh. I am using webkit driver personally, the PR doesnt touch anything in that codepath to break chrome in any way. perhaps a CI issue. but I had the same error when tried to switch to chrome from webkit, didn't do it because of this, but didn't investigate further either. |
Problem
LogStore#pollForSpokenPhrasesuses an unbounded while (true) loop that can hang indefinitely when VoiceOver output never stabilizes. This occurs when:When phrases don't stabilize, the polling loop runs forever, blocking all subsequent commands and potentially freezing the entire test suite.
Solution
Add
MAX_SPOKEN_PHRASES_POLL_COUNTconstant (60 polls ≈ 3 second timeout) to bound the stabilization loop:After ~3 seconds, the method returns the best phrases collected so far instead of hanging forever.
Testing
Tested on 30+ interactive sequences with dynamic content (modals, disappearing elements, state transitions):
Breaking Changes
None. Adds safety timeout while preserving existing stabilization behavior.
Files changed:
src/macOS/VoiceOver/constants.ts- Added MAX_SPOKEN_PHRASES_POLL_COUNT = 60src/macOS/VoiceOver/LogStore.ts- Changed while (true) to while (pollCount < MAX_SPOKEN_PHRASES_POLL_COUNT)