Treat intent threads as new based on gate.status. #4558
Merged
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.
This should resolve a problem that Panos brought up in chat today.
When the review functionality was first designed, there was no
gate.state
variable, instead the state of the gate was always derived from the set of votes on that gate. So, in detect_intent, an incoming email message is considered to be the start of an intent thread if there were no votes on its gate. The problem with that is that a reviewer can manually vote REVIEW_STARTED or a vote of NO_RESPONSE can be entered for an assigned reviewer. So, the list of votes might not be empty even before the intent thread starts.Now that we have
gate.state
and it has been backfilled for all existing gates, we can use that to make a better decision about when an incoming email message is actually the start of an intent thread. If the gate is in the initial PREPARING state, regardless of Votes, then we treat the thread as new, and so the gate becomes REVIEW_REQUESTED. If the gate was anything else, we treat the message as an ongoing discussion, which basically means that we leave the gate state as-is.