Skip to content

PIR: Add initial scan restart on PIR dashboard launch#8959

Open
landomen wants to merge 2 commits into
developfrom
feature/domen/pir-resume-incomplete-initial-scan
Open

PIR: Add initial scan restart on PIR dashboard launch#8959
landomen wants to merge 2 commits into
developfrom
feature/domen/pir-resume-incomplete-initial-scan

Conversation

@landomen

@landomen landomen commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

  • Triggers the foreground scan when PIR dashboard is opened and there are incomplete jobs.
  • Handles coordination between foreground service and scheduled worker to now cancel each other
  • TODO: pixel updates - next PR

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_EXECUTED jobs, nothing running), it can now restart the foreground scan instead of only logging a pixel. Behavior is gated by a new remote toggle resumeInitialScanOnDashboardOpen (default on).

Resume path: On the first INITIAL_SCAN_STATUS message per dashboard activity, if resume is warranted, the handler still emits reportInitialScanIncomplete, then calls PirForegroundScanServiceStarter.startResumeScan() with MANUAL_INITIAL so 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 PirForegroundScanServiceMonitor and PirScanScheduler.isScheduledScanRunning() for testability.

Reviewed by Cursor Bugbot for commit a569742. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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.

2 participants