diff --git a/mycroft/skills/mycroft_skill/mycroft_skill.py b/mycroft/skills/mycroft_skill/mycroft_skill.py index 4302b49b4ce4..67bfac529f8a 100644 --- a/mycroft/skills/mycroft_skill/mycroft_skill.py +++ b/mycroft/skills/mycroft_skill/mycroft_skill.py @@ -411,7 +411,16 @@ def converse(self, message=None): return False def __get_response(self): - """Helper to get a reponse from the user + """Helper to get a response from the user + + NOTE: There is a race condition here. There is a small amount of + time between the end of the device speaking and the converse method + being overridden in this method. If an utterance is injected during + this time, the wrong converse method is executed. The condition is + hidden during normal use due to the amount of time it takes a user + to speak a response. The condition is revealed when an automated + process injects an utterance quicker than this method can flip the + converse methods. Returns: str: user's response or None on a timeout diff --git a/test/integrationtests/voight_kampff/features/steps/utterance_responses.py b/test/integrationtests/voight_kampff/features/steps/utterance_responses.py index b0d118a3284c..7fd1c1991263 100644 --- a/test/integrationtests/voight_kampff/features/steps/utterance_responses.py +++ b/test/integrationtests/voight_kampff/features/steps/utterance_responses.py @@ -235,6 +235,12 @@ def check_contains(message): @then('the user replies "{text}"') @then('the user says "{text}"') def then_user_follow_up(context, text): + """Send a user response after being prompted by device. + + The sleep after the device is finished speaking is to address a race + condition in the MycroftSkill base class conversational code. It can + be removed when the race condition is addressed. + """ wait_while_speaking() time.sleep(2) context.bus.emit(Message('recognizer_loop:utterance',