PIR: Add email polling mechanism#8581
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
787d0ae to
f7a3f45
Compare
ec6dfe0 to
a5d392a
Compare
a5d392a to
f9b69ff
Compare
f7a3f45 to
de20666
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit de20666. Configure here.
| emailAddress = state.generatedEmailData?.emailAddress.orEmpty(), | ||
| attemptId = state.attemptId, | ||
| extractFields = actionToExecute.extract, | ||
| pollingIntervalSeconds = actionToExecute.pollingTime.toIntOrNull() ?: DEFAULT_EMAIL_DATA_POLL_INTERVAL_SECONDS, |
There was a problem hiding this comment.
pollingTime likely misinterpreted as interval instead of total timeout
Medium Severity
The GetEmailData.pollingTime field is mapped to pollingIntervalSeconds (the delay between polls), while maxTimeoutSeconds is hardcoded to 60. The field name pollingTime semantically means total polling duration, consistent with its sibling EmailConfirmation.pollingTime. If the backend sends a value like "30" meaning "poll for 30 seconds total," the code instead waits 30 seconds between each poll, and maxAttempts becomes 60/30 = 2 — radically different from the intended behavior. Conversely, a pollingTime of "120" yields maxAttempts = 60/120 = 0, timing out immediately after a single attempt. pollingTime likely belongs as maxTimeoutSeconds, with a fixed constant for the interval.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit de20666. Configure here.
f9b69ff to
8197210
Compare
de20666 to
8f49ae6
Compare
8197210 to
9ef29ae
Compare
8f49ae6 to
90eb151
Compare



Task/Issue URL: https://app.asana.com/1/137249556945/task/1213993026941871?focus=true
Description
Adds polling mechanism for getEmailData action.
Steps to test this PR
Will be testable later when feature is complete.
UI changes
No UI changes
Note
Medium Risk
Adds new backend polling and retry/timeout logic into the PIR actions runner and state engine flow, which can impact opt-out/scan execution timing and failure behavior.
Overview
Implements the previously stubbed
getEmailDataflow by introducingEmailDataResolver/RealEmailDataResolverto poll the backend for email-extracted fields (e.g. verification codes), returningSuccess/Pending/Failure.Wires email polling into
RealPirActionsRunnerand the state engine:GetEmailDatanow emits anAwaitEmailDataside effect (with a newEMAIL_DATA_POLLstage), pending results triggerRetryAwaitEmailDatauntil timeout, and ready results dispatchEmailDataReceivedto store extracted data and continue executing the next broker action. Tests and integration harnesses are updated/added to cover resolver behavior, new event handlers, and the new runner dependency.Reviewed by Cursor Bugbot for commit 90eb151. Bugbot is set up for automated code reviews on this repo. Configure here.