PIR: Add initial scan restart on PIR dashboard launch#8959
Open
landomen wants to merge 2 commits into
Open
Conversation
This file contains hidden or 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
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.

Task/Issue URL: https://app.asana.com/1/137249556945/project/1203581873609357/task/1215725818623013?focus=true
Tech Design URL (if applicable): https://app.asana.com/1/137249556945/project/1203581873609357/task/1213368145276564?focus=true
Description
Steps to test this PR
See https://app.asana.com/1/137249556945/project/1203581873609357/task/1215930117038075?focus=true
UI changes
No UI changes
Note
Medium Risk
Changes scan scheduling and foreground/background coordination; mis-guarding could duplicate scans or leave interrupted initial scans unfinished, though toggles and explicit skip paths limit blast radius.
Overview
When the PIR dashboard loads and detects an interrupted initial scan (pending
NOT_EXECUTEDjobs, nothing running), it can now restart the foreground scan instead of only logging a pixel. Behavior is gated by a new remote toggleresumeInitialScanOnDashboardOpen(default on).Resume path: On the first
INITIAL_SCAN_STATUSmessage per dashboard activity, if resume is warranted, the handler still emitsreportInitialScanIncomplete, then callsPirForegroundScanServiceStarter.startResumeScan()withMANUAL_INITIALso only remaining brokers run.Coordination: Resume is suppressed when a foreground scan or the periodic scheduled scan worker is already running. The scheduled worker skips its run (success, no jobs) if the foreground service is active—avoiding overlapping scan execution. Running-state checks move behind injectable
PirForegroundScanServiceMonitorandPirScanScheduler.isScheduledScanRunning()for testability.Reviewed by Cursor Bugbot for commit a569742. Bugbot is set up for automated code reviews on this repo. Configure here.