-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race condition between bot and user activity #3705
Merged
Merged
Conversation
This file contains 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
compulim
requested review from
a-b-r-o-w-n,
amal-khalaf,
beyackle,
corinagum,
cwhitten,
srinaath,
tdurnford and
tonyanziano
as code owners
February 4, 2021 15:51
corinagum
reviewed
Feb 4, 2021
corinagum
reviewed
Feb 4, 2021
corinagum
reviewed
Feb 4, 2021
Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com>
corinagum
reviewed
Feb 4, 2021
Might want to change 'bogus' to 'non-existent' - I don't know if this is a polycheck violation or not. |
corinagum
approved these changes
Feb 4, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending a few comments.
Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com>
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.
Changelog Entry
Fixed
Description
A race condition between the first bot activity and first user activity will cause the bot activity to be delayed if the user activity shows up first.
Design
When the bot activity (or any activity with "replyToId") has arrived, we will check if its precedence is already in the transcript or not. If it is not, we will wait for up to 5 seconds. This is for resolving an accessibility issue due to protocol/SDK deficiency.
But since the first bot activity will have a "replyToId" pointing to a bogus activity (a.k.a. never exists), thus, the bot activity will always subject to delay.
To mitigate this issue, we will check the transcript to see if the bot activity is the very first (i.e. with a bogus activity). If it is the very first, then, we allow it to show up without delay.
The problem lies in our transcript check; we check for all kinds of activities, including activities from both bot and user. Due to the race condition, the user's activity is already in the transcript. Thus, the bot activity is not the "first"; we don't allow the first bot activity to show up immediately.
The check's primary object is to check if the "replyToId" is a bogus ID or not. The check should be true if the transcript does not have any bot activities, instead of any activities.
Specific Changes
queueIncomingActivitySaga.js
, we should only check for bot's activities, not every activityCHANGELOG.md
I have updated documentationReview Checklist
Browser and platform compatibilities reviewedCSS styles reviewed (minimal rules, noz-index
)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)