Skip to content

PIR: Add email polling mechanism#8581

Open
landomen wants to merge 2 commits into
feature/domen/pir-email-flexibility-generate-emailfrom
feature/domen/pir-email-flexibility-polling
Open

PIR: Add email polling mechanism#8581
landomen wants to merge 2 commits into
feature/domen/pir-email-flexibility-generate-emailfrom
feature/domen/pir-email-flexibility-polling

Conversation

@landomen
Copy link
Copy Markdown
Contributor

@landomen landomen commented May 15, 2026

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 getEmailData flow by introducing EmailDataResolver/RealEmailDataResolver to poll the backend for email-extracted fields (e.g. verification codes), returning Success/Pending/Failure.

Wires email polling into RealPirActionsRunner and the state engine: GetEmailData now emits an AwaitEmailData side effect (with a new EMAIL_DATA_POLL stage), pending results trigger RetryAwaitEmailData until timeout, and ready results dispatch EmailDataReceived to 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.

Copy link
Copy Markdown
Contributor Author

landomen commented May 15, 2026

@landomen landomen force-pushed the feature/domen/pir-email-flexibility-polling branch from 787d0ae to f7a3f45 Compare May 15, 2026 16:19
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-generate-email branch from ec6dfe0 to a5d392a Compare May 15, 2026 16:19
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-generate-email branch from a5d392a to f9b69ff Compare May 19, 2026 11:00
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-polling branch from f7a3f45 to de20666 Compare May 19, 2026 11:00
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit de20666. Configure here.

@landomen landomen force-pushed the feature/domen/pir-email-flexibility-generate-email branch from f9b69ff to 8197210 Compare May 21, 2026 17:48
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-polling branch from de20666 to 8f49ae6 Compare May 21, 2026 17:48
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-generate-email branch from 8197210 to 9ef29ae Compare May 22, 2026 06:46
@landomen landomen force-pushed the feature/domen/pir-email-flexibility-polling branch from 8f49ae6 to 90eb151 Compare May 22, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant