Reset Launch Services database whenever it seems to be having problems and print a warning if it's been reset more than once within a week

Change-Id: I9ea68550fc3d4657490220554d1ebd403849d850
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/63040
Commit-Queue: Victoria Ashworth <vashworth@google.com>
Reviewed-by: Christopher Fujino <fujino@google.com>
diff --git a/recipe_modules/osx_sdk/api.py b/recipe_modules/osx_sdk/api.py
index 9a40161..1060a44 100644
--- a/recipe_modules/osx_sdk/api.py
+++ b/recipe_modules/osx_sdk/api.py
@@ -10,7 +10,7 @@
 from contextlib import contextmanager
 
 from recipe_engine import recipe_api
-from datetime import datetime
+from datetime import datetime, timedelta
 
 # Rationalized from https://en.wikipedia.org/wiki/Xcode.
 #
@@ -366,6 +366,7 @@
       # 'install xcode from cipd' step may get stuck until it times out.
       self._verify_xcode(install_path)
     except self.m.step.StepFailure:
+      self._diagnose_unresponsive_mac(devicelab, skip_check=True)
       self._cleanup_cache = True
       self._clean_xcode_cache(devicelab)
 
@@ -428,67 +429,85 @@
             ok_ret='any',
         )
 
-  def _diagnose_unresponsive_mac(self, devicelab):
+  def _diagnose_unresponsive_mac(self, devicelab, skip_check=False):
     """Checks if `xcodebuild` commands may have potentially hung due to Launch
-    Services issues. If so, reset the Launch Services database. Only reset the
-    database if it hasn't been reset in the past week.
+    Services issues. If so, reset the Launch Services database. Print a warning
+    if the database has already been reset in the past week.
 
     Args:
       devicelab: (bool) tells the module which path we should be working with.
+      skip_check: (bool) if true, skips checking the logs and goes directly to
+      resetting the database.
     """
 
-    with self.m.step.nest('verify launch services'):
-      # Check if xcodebuild commands have potentially been slowed by Launch
-      # Services.
-      xcodebuild_logs = self.m.step(
-          'Check if xcodebuild impacted by Launch Services',
-          [
-              'log',
-              'show',
-              '--last',
-              '24h',
-              '--style',
-              'compact',
-              '--predicate',
-              'logType == "error" AND process == "xcodebuild" AND '
-              'subsystem == "com.apple.launchservices" AND composedMessage '
-              'CONTAINS "disconnect event interruption received for service"',
-          ],
-          stdout=self.m.raw_io.output_text(add_output_log=True),
-      )
-
-      # Remove first line, which is headers.
-      xcodebuild_logs_stdout = xcodebuild_logs.stdout.splitlines()[1:]
-
-      # Only reset Launch Services db if there are logs indicating xcodebuild
-      # has failed due to Launch Services.
-      if len(xcodebuild_logs_stdout) == 0:
-        return
-
+    with self.m.step.nest('verify launch services') as display_step:
       launch_services_reset_log = self._get_xcode_base_cache_path(
           devicelab
       ) / 'launch_services_reset_log.txt'
 
       reset_logs = ''
+      last_entry_time = None
       if self.m.path.exists(launch_services_reset_log):
         reset_logs = self.m.file.read_text(
             'Check if Launch Services db has been reset recently',
             launch_services_reset_log,
         )
-
         try:
           # Get last entry in log.
           last_entry = reset_logs.splitlines()[-1].rstrip()
           last_entry_time = datetime.strptime(last_entry, "%Y-%m-%d %H:%M:%S")
-
-          # If Launch Services has already been reset within last 7 days,
-          # don't reset again.
-          if (self.now() - last_entry_time).days <= 7:
-            return
         except:
           # If there was an invalid date, reset the log file.
           reset_logs = ''
 
+      if skip_check == False:
+        # If last log entry was within 24 hours, only search logs since that time
+        # (with a 30 minute buffer). Otherwise search the last 24 hours
+        if last_entry_time and (self.now() - last_entry_time).days <= 1:
+          search_time = (last_entry_time +
+                         timedelta(minutes=30)).strftime("%Y-%m-%d %H:%M:%S")
+          time_parameters = [
+              '--start',
+              search_time,
+          ]
+        else:
+          time_parameters = [
+              '--last',
+              '24h',
+          ]
+
+        # Check if xcodebuild commands have potentially been slowed by Launch
+        # Services.
+        xcodebuild_logs = self.m.step(
+            'Check if xcodebuild impacted by Launch Services',
+            [
+                'log',
+                'show',
+                *time_parameters,
+                '--style',
+                'compact',
+                '--predicate',
+                'logType == "error" AND process == "xcodebuild" AND '
+                'subsystem == "com.apple.launchservices" AND composedMessage '
+                'CONTAINS "disconnect event interruption received for service"',
+            ],
+            stdout=self.m.raw_io.output_text(add_output_log=True),
+        )
+
+        # Remove first line, which is headers.
+        xcodebuild_logs_stdout = xcodebuild_logs.stdout.splitlines()[1:]
+
+        # Only reset Launch Services db if there are logs indicating xcodebuild
+        # has failed due to Launch Services.
+        if len(xcodebuild_logs_stdout) == 0:
+          return
+
+      # If Launch Services was reset within a week and we have gotten more
+      # errors since then, print a warning.
+      if last_entry_time and (self.now() - last_entry_time).days <= 7:
+        display_step.status = self.m.step.INFRA_FAILURE
+        display_step.step_text = 'Launch Services has already been reset recently. Please file a bug and see go/flutter-infra-macos-troubleshoot.'
+
       start_time = self.now().strftime("%Y-%m-%d %H:%M:%S")
 
       self.m.step(
diff --git a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_already_reset_invalid date.json b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_already_reset_invalid date.json
index 8ee4a3a..8382939 100644
--- a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_already_reset_invalid date.json
+++ b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_already_reset_invalid date.json
@@ -12,6 +12,25 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "verify launch services.Check if Launch Services db has been reset recently",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@invalid date@@@",
+      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "log",
       "show",
       "--last",
@@ -33,25 +52,6 @@
   },
   {
     "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if Launch Services db has been reset recently",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@invalid date@@@",
-      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
-    ]
-  },
-  {
-    "cmd": [
       "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",
       "-kill",
       "-r",
diff --git a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_recently_reset.json b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_recently_reset.json
deleted file mode 100644
index 88c1392..0000000
--- a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_recently_reset.json
+++ /dev/null
@@ -1,1248 +0,0 @@
-[
-  {
-    "cmd": [
-      "sw_vers",
-      "-productVersion"
-    ],
-    "name": "find macOS version"
-  },
-  {
-    "cmd": [],
-    "name": "verify launch services"
-  },
-  {
-    "cmd": [
-      "log",
-      "show",
-      "--last",
-      "24h",
-      "--style",
-      "compact",
-      "--predicate",
-      "logType == \"error\" AND process == \"xcodebuild\" AND subsystem == \"com.apple.launchservices\" AND composedMessage CONTAINS \"disconnect event interruption received for service\""
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if xcodebuild impacted by Launch Services",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@Timestamp               Ty Process[PID:TID]@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if Launch Services db has been reset recently",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
-      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-13 13:43:21@@@",
-      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "echo",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "show app_dir"
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Show xcode cache"
-  },
-  {
-    "cmd": [],
-    "name": "Running Cache Micro Manager on [CACHE]/osx_sdk."
-  },
-  {
-    "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "listdir",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Running Cache Micro Manager on [CACHE]/osx_sdk..Reading cache directory [CACHE]/osx_sdk",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@listdir@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Show xcode cache (2)"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.check xcode version",
-    "timeout": 300,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.reset XCode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "CoreServicesUIAgent"
-    ],
-    "infra_step": true,
-    "name": "install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.dismiss damaged notification",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CACHE]/osx_sdk/xcode_deadbeef",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install xcode.ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "install xcode.Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CACHE]/osx_sdk/xcode_deadbeef/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install xcode.install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "-v",
-      "com.apple.CoreSimulator.CoreSimulatorDevice"
-    ],
-    "infra_step": true,
-    "name": "kill dart"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "select xcode"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list"
-    ],
-    "infra_step": true,
-    "name": "list simulators"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list",
-      "runtimes"
-    ],
-    "infra_step": true,
-    "name": "list runtimes"
-  },
-  {
-    "cmd": [
-      "rm",
-      "-rf",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up Xcode cache"
-  },
-  {
-    "cmd": [
-      "echo",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "show app_dir (2)"
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Show xcode cache (3)"
-  },
-  {
-    "cmd": [],
-    "name": "Running Cache Micro Manager on [CACHE]/osx_sdk. (2)"
-  },
-  {
-    "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "listdir",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Running Cache Micro Manager on [CACHE]/osx_sdk. (2).Reading cache directory [CACHE]/osx_sdk",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@listdir@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "Show xcode cache (4)"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode (2)"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode (2).verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.check xcode version",
-    "timeout": 300,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.reset XCode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "CoreServicesUIAgent"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.dismiss damaged notification",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CACHE]/osx_sdk/xcode_deadbeef",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CACHE]/osx_sdk/xcode_deadbeef/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install xcode (2).install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "Cleaning up runtimes cache"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache.select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "runtime",
-      "delete",
-      "all"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache.Cleaning up mounted simulator runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache.check xcode version",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list",
-      "runtimes"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache.list runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes"
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes.install xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes.install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@3@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.check xcode version",
-    "timeout": 300,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@3@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.reset XCode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@3@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "CoreServicesUIAgent"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.dismiss damaged notification",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@3@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CACHE]/osx_sdk/xcode_deadbeef",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CACHE]/osx_sdk/xcode_deadbeef"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CACHE]/osx_sdk/xcode_deadbeef/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install runtimes.install xcode.install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "-v",
-      "com.apple.CoreSimulator.CoreSimulatorDevice"
-    ],
-    "infra_step": true,
-    "name": "kill dart (2)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "[CACHE]/osx_sdk/xcode_deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "select xcode (2)"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list"
-    ],
-    "infra_step": true,
-    "name": "list simulators (2)"
-  },
-  {
-    "cmd": [
-      "gn",
-      "gen",
-      "out/Release"
-    ],
-    "name": "gn"
-  },
-  {
-    "cmd": [
-      "ninja",
-      "-C",
-      "out/Release"
-    ],
-    "name": "ninja"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "reset XCode"
-  },
-  {
-    "cmd": [],
-    "name": "verify launch services (2)"
-  },
-  {
-    "cmd": [
-      "log",
-      "show",
-      "--last",
-      "24h",
-      "--style",
-      "compact",
-      "--predicate",
-      "logType == \"error\" AND process == \"xcodebuild\" AND subsystem == \"com.apple.launchservices\" AND composedMessage CONTAINS \"disconnect event interruption received for service\""
-    ],
-    "infra_step": true,
-    "name": "verify launch services (2).Check if xcodebuild impacted by Launch Services",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "rmtree",
-      "/opt/flutter/xcode/deadbeef"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up Xcode cache (2)"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode (3)"
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CLEANUP]/tmp_tmp_1/osx_sdk",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install xcode (3).ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CLEANUP]/tmp_tmp_1/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "install xcode (3).Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CLEANUP]/tmp_tmp_1/osx_sdk/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "/opt/flutter/xcode/deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install xcode (3).install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "Cleaning up runtimes cache (2)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "/opt/flutter/xcode/deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (2).select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "runtime",
-      "delete",
-      "all"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (2).Cleaning up mounted simulator runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (2).check xcode version",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list",
-      "runtimes"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (2).list runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes (2)"
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes (2).install xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CLEANUP]/tmp_tmp_1/osx_sdk",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (2).install xcode.ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CLEANUP]/tmp_tmp_1/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (2).install xcode.Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CLEANUP]/tmp_tmp_1/osx_sdk/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "/opt/flutter/xcode/deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (2).install xcode.install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "-v",
-      "com.apple.CoreSimulator.CoreSimulatorDevice"
-    ],
-    "infra_step": true,
-    "name": "kill dart (3)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "/opt/flutter/xcode/deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "select xcode (3)"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list"
-    ],
-    "infra_step": true,
-    "name": "list simulators (3)"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list",
-      "runtimes"
-    ],
-    "infra_step": true,
-    "name": "list runtimes (2)"
-  },
-  {
-    "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "rmtree",
-      "/opt/flutter/xcode/deadbeef"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up Xcode cache (3)"
-  },
-  {
-    "cmd": [],
-    "name": "install xcode (4)"
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CLEANUP]/tmp_tmp_2/osx_sdk",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install xcode (4).ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CLEANUP]/tmp_tmp_2/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "install xcode (4).Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CLEANUP]/tmp_tmp_2/osx_sdk/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "/opt/flutter/xcode/deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install xcode (4).install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "Cleaning up runtimes cache (3)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "/opt/flutter/xcode/deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (3).select xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "runtime",
-      "delete",
-      "all"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (3).Cleaning up mounted simulator runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "xcodebuild",
-      "-version"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (3).check xcode version",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list",
-      "runtimes"
-    ],
-    "infra_step": true,
-    "name": "Cleaning up runtimes cache (3).list runtimes",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes (3)"
-  },
-  {
-    "cmd": [],
-    "name": "install runtimes (3).install xcode",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "cipd",
-      "ensure",
-      "-root",
-      "[CLEANUP]/tmp_tmp_2/osx_sdk",
-      "-ensure-file",
-      "infra/tools/mac_toolchain/${platform} latest",
-      "-max-threads",
-      "0",
-      "-json-output",
-      "/path/to/tmp/json"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (3).install xcode.ensure_installed",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@",
-      "@@@STEP_LOG_LINE@json.output@{@@@",
-      "@@@STEP_LOG_LINE@json.output@  \"result\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"\": [@@@",
-      "@@@STEP_LOG_LINE@json.output@      {@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
-      "@@@STEP_LOG_LINE@json.output@        \"package\": \"infra/tools/mac_toolchain/resolved-platform\"@@@",
-      "@@@STEP_LOG_LINE@json.output@      }@@@",
-      "@@@STEP_LOG_LINE@json.output@    ]@@@",
-      "@@@STEP_LOG_LINE@json.output@  }@@@",
-      "@@@STEP_LOG_LINE@json.output@}@@@",
-      "@@@STEP_LOG_END@json.output@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "ls",
-      "-al",
-      "[CLEANUP]/tmp_tmp_2/osx_sdk"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (3).install xcode.Show tool_dir cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "[CLEANUP]/tmp_tmp_2/osx_sdk/mac_toolchain",
-      "install",
-      "-kind",
-      "mac",
-      "-xcode-version",
-      "deadbeef",
-      "-output-dir",
-      "/opt/flutter/xcode/deadbeef/XCode.app",
-      "-cipd-package-prefix",
-      "infra_internal/ios/xcode",
-      "-with-runtime=True",
-      "-verbose"
-    ],
-    "infra_step": true,
-    "name": "install runtimes (3).install xcode.install xcode from cipd",
-    "timeout": 1800,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "killall",
-      "-9",
-      "-v",
-      "com.apple.CoreSimulator.CoreSimulatorDevice"
-    ],
-    "infra_step": true,
-    "name": "kill dart (4)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--switch",
-      "/opt/flutter/xcode/deadbeef/XCode.app"
-    ],
-    "infra_step": true,
-    "name": "select xcode (4)"
-  },
-  {
-    "cmd": [
-      "xcrun",
-      "simctl",
-      "list"
-    ],
-    "infra_step": true,
-    "name": "list simulators (4)"
-  },
-  {
-    "cmd": [
-      "gn",
-      "gen",
-      "out/Release"
-    ],
-    "name": "gn (2)"
-  },
-  {
-    "cmd": [
-      "ninja",
-      "-C",
-      "out/Release"
-    ],
-    "name": "ninja (2)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "reset XCode (2)"
-  },
-  {
-    "cmd": [
-      "sudo",
-      "xcode-select",
-      "--reset"
-    ],
-    "infra_step": true,
-    "name": "reset XCode (3)"
-  },
-  {
-    "name": "$result"
-  }
-]
\ No newline at end of file
diff --git a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_longer_than_7_days.json
similarity index 99%
rename from recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
rename to recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_longer_than_7_days.json
index 1420a62..247d187 100644
--- a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
+++ b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_longer_than_7_days.json
@@ -12,6 +12,25 @@
   },
   {
     "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "verify launch services.Check if Launch Services db has been reset recently",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
+      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
       "log",
       "show",
       "--last",
@@ -33,25 +52,6 @@
   },
   {
     "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if Launch Services db has been reset recently",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
-      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
-    ]
-  },
-  {
-    "cmd": [
       "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",
       "-kill",
       "-r",
diff --git a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_7_days.json
similarity index 98%
copy from recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
copy to recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_7_days.json
index 1420a62..715c3af 100644
--- a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
+++ b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_7_days.json
@@ -8,7 +8,31 @@
   },
   {
     "cmd": [],
-    "name": "verify launch services"
+    "name": "verify launch services",
+    "~followup_annotations": [
+      "@@@STEP_TEXT@Launch Services has already been reset recently. Please file a bug and see go/flutter-infra-macos-troubleshoot.@@@",
+      "@@@STEP_EXCEPTION@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "verify launch services.Check if Launch Services db has been reset recently",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-13 13:43:21@@@",
+      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
+    ]
   },
   {
     "cmd": [
@@ -33,25 +57,6 @@
   },
   {
     "cmd": [
-      "vpython3",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[CACHE]/osx_sdk/launch_services_reset_log.txt",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if Launch Services db has been reset recently",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
-      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
-    ]
-  },
-  {
-    "cmd": [
       "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",
       "-kill",
       "-r",
@@ -76,7 +81,7 @@
       "--json-output",
       "/path/to/tmp/json",
       "copy",
-      "2023-12-01 13:43:21\n2023-12-15 13:43:21",
+      "2023-12-01 13:43:21\n2023-12-13 13:43:21\n2023-12-15 13:43:21",
       "[CACHE]/osx_sdk/launch_services_reset_log.txt"
     ],
     "infra_step": true,
@@ -84,6 +89,7 @@
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-13 13:43:21@@@",
       "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-15 13:43:21@@@",
       "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
     ]
diff --git a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_a_day.json
similarity index 97%
copy from recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
copy to recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_a_day.json
index 1420a62..868b84b 100644
--- a/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_long_ago.json
+++ b/recipe_modules/osx_sdk/examples/full.expected/launch_services_unresponsive_mac_reset_within_a_day.json
@@ -8,27 +8,10 @@
   },
   {
     "cmd": [],
-    "name": "verify launch services"
-  },
-  {
-    "cmd": [
-      "log",
-      "show",
-      "--last",
-      "24h",
-      "--style",
-      "compact",
-      "--predicate",
-      "logType == \"error\" AND process == \"xcodebuild\" AND subsystem == \"com.apple.launchservices\" AND composedMessage CONTAINS \"disconnect event interruption received for service\""
-    ],
-    "infra_step": true,
-    "name": "verify launch services.Check if xcodebuild impacted by Launch Services",
+    "name": "verify launch services",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@Timestamp               Ty Process[PID:TID]@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb@@@",
-      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb@@@",
-      "@@@STEP_LOG_END@raw_io.output_text@@@"
+      "@@@STEP_TEXT@Launch Services has already been reset recently. Please file a bug and see go/flutter-infra-macos-troubleshoot.@@@",
+      "@@@STEP_EXCEPTION@@@"
     ]
   },
   {
@@ -47,11 +30,33 @@
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-15 00:00:00@@@",
       "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
     ]
   },
   {
     "cmd": [
+      "log",
+      "show",
+      "--start",
+      "2023-12-15 00:30:00",
+      "--style",
+      "compact",
+      "--predicate",
+      "logType == \"error\" AND process == \"xcodebuild\" AND subsystem == \"com.apple.launchservices\" AND composedMessage CONTAINS \"disconnect event interruption received for service\""
+    ],
+    "infra_step": true,
+    "name": "verify launch services.Check if xcodebuild impacted by Launch Services",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@Timestamp               Ty Process[PID:TID]@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb@@@",
+      "@@@STEP_LOG_END@raw_io.output_text@@@"
+    ]
+  },
+  {
+    "cmd": [
       "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",
       "-kill",
       "-r",
@@ -76,7 +81,7 @@
       "--json-output",
       "/path/to/tmp/json",
       "copy",
-      "2023-12-01 13:43:21\n2023-12-15 13:43:21",
+      "2023-12-01 13:43:21\n2023-12-15 00:00:00\n2023-12-15 13:43:21",
       "[CACHE]/osx_sdk/launch_services_reset_log.txt"
     ],
     "infra_step": true,
@@ -84,6 +89,7 @@
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-01 13:43:21@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-15 00:00:00@@@",
       "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-15 13:43:21@@@",
       "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
     ]
diff --git a/recipe_modules/osx_sdk/examples/full.expected/xcode_install_fails_passes_on_retry.json b/recipe_modules/osx_sdk/examples/full.expected/xcode_install_fails_passes_on_retry.json
index 8a8a3f1..0671e45 100644
--- a/recipe_modules/osx_sdk/examples/full.expected/xcode_install_fails_passes_on_retry.json
+++ b/recipe_modules/osx_sdk/examples/full.expected/xcode_install_fails_passes_on_retry.json
@@ -154,6 +154,51 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "install xcode.verify launch services",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",
+      "-kill",
+      "-r",
+      "-domain",
+      "local",
+      "-domain",
+      "system",
+      "-domain",
+      "user"
+    ],
+    "infra_step": true,
+    "name": "install xcode.verify launch services.Reset and rescan Launch Services db",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "\n2023-12-15 13:43:21",
+      "[CACHE]/osx_sdk/launch_services_reset_log.txt"
+    ],
+    "infra_step": true,
+    "name": "install xcode.verify launch services.Update Launch Services reset log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@@@@",
+      "@@@STEP_LOG_LINE@launch_services_reset_log.txt@2023-12-15 13:43:21@@@",
+      "@@@STEP_LOG_END@launch_services_reset_log.txt@@@"
+    ]
+  },
+  {
     "cmd": [
       "rm",
       "-rf",
diff --git a/recipe_modules/osx_sdk/examples/full.py b/recipe_modules/osx_sdk/examples/full.py
index 326aeb1..48c4f9d 100644
--- a/recipe_modules/osx_sdk/examples/full.py
+++ b/recipe_modules/osx_sdk/examples/full.py
@@ -18,7 +18,10 @@
 from datetime import datetime
 from unittest.mock import Mock
 
-_MOCK_TIME_NOW = Mock(return_value=datetime(2023, 12, 15, 13, 43, 21, 621929)) # 2023-12-15 13:43:21
+_MOCK_TIME_NOW = Mock(
+    return_value=datetime(2023, 12, 15, 13, 43, 21, 621929)
+)  # 2023-12-15 13:43:21
+
 
 def RunSteps(api):
   api.osx_sdk.now = _MOCK_TIME_NOW
@@ -36,10 +39,9 @@
     yield (api.test(platform) + api.platform.name(platform))
 
   yield api.test(
-      'skipped_xcode',
-      api.platform.name('mac'),
+      'skipped_xcode', api.platform.name('mac'),
       api.properties(**{'$flutter/osx_sdk': {
-        'skip_xcode_install': True,
+          'skip_xcode_install': True,
       }})
   )
 
@@ -48,7 +50,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'cleanup_cache': True
               }
           }
@@ -67,7 +70,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-13-0', 'ios-14-0']
               }
           }
@@ -140,7 +144,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-16-4', 'ios-16-2']
               }
           }
@@ -158,7 +163,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-16-4_14e300c']
               }
           }
@@ -185,7 +191,10 @@
           'install runtimes.cipd describe ios-16-4_14e300c.cipd describe infra_internal/ios/xcode/ios_runtime_dmg (2)',
           api.json.output({
               'result': {
-                  'pin': {'package': 'xxx', 'instance_id': 'xxx'},
+                  'pin': {
+                      'package': 'xxx',
+                      'instance_id': 'xxx'
+                  },
                   'registered_by':
                       'xxx',
                   'registered_ts':
@@ -193,11 +202,13 @@
                   'tags': [
                       {
                           'tag': 'ios_runtime_build:20e247',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                       {
                           'tag': 'ios_runtime_version:ios-16-4',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                   ],
               }
@@ -222,7 +233,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-16-4_14e300c']
               }
           }
@@ -246,7 +258,10 @@
           'install runtimes.cipd describe ios-16-4_14e300c.cipd describe infra_internal/ios/xcode/ios_runtime_dmg (2)',
           api.json.output({
               'result': {
-                  'pin': {'package': 'xxx', 'instance_id': 'xxx'},
+                  'pin': {
+                      'package': 'xxx',
+                      'instance_id': 'xxx'
+                  },
                   'registered_by':
                       'xxx',
                   'registered_ts':
@@ -254,11 +269,13 @@
                   'tags': [
                       {
                           'tag': 'ios_runtime_build:20e247',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                       {
                           'tag': 'ios_runtime_version:ios-16-4',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                   ],
               }
@@ -283,7 +300,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-16-4_14e300c']
               }
           }
@@ -307,14 +325,18 @@
           'install runtimes.cipd describe ios-16-4_14e300c.cipd describe infra_internal/ios/xcode/ios_runtime_dmg (2)',
           api.json.output({
               'result': {
-                  'pin': {'package': 'xxx', 'instance_id': 'xxx'},
+                  'pin': {
+                      'package': 'xxx',
+                      'instance_id': 'xxx'
+                  },
                   'registered_by':
                       'xxx',
                   'registered_ts':
                       'xxx',
                   'tags': [{
                       'tag': 'ios_runtime_build_invalid_tag',
-                      'registered_by': 'xxx', 'registered_ts': 'xxx'
+                      'registered_by': 'xxx',
+                      'registered_ts': 'xxx'
                   }],
               }
           }),
@@ -332,7 +354,8 @@
       api.properties(
           **{
               '$flutter/osx_sdk': {
-                  'sdk_version': 'deadbeef', 'toolchain_ver_intel': '123abc',
+                  'sdk_version': 'deadbeef',
+                  'toolchain_ver_intel': '123abc',
                   'runtime_versions': ['ios-16-4_14e300c']
               }
           }
@@ -404,7 +427,10 @@
           'install runtimes.cipd describe ios-16-4_14e300c.cipd describe infra_internal/ios/xcode/ios_runtime_dmg',
           api.json.output({
               'result': {
-                  'pin': {'package': 'xxx', 'instance_id': 'xxx'},
+                  'pin': {
+                      'package': 'xxx',
+                      'instance_id': 'xxx'
+                  },
                   'registered_by':
                       'xxx',
                   'registered_ts':
@@ -412,11 +438,13 @@
                   'tags': [
                       {
                           'tag': 'ios_runtime_build:20e247',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                       {
                           'tag': 'ios_runtime_version:ios-16-4',
-                          'registered_by': 'xxx', 'registered_ts': 'xxx'
+                          'registered_by': 'xxx',
+                          'registered_ts': 'xxx'
                       },
                   ],
               }
@@ -539,7 +567,9 @@
           "find macOS version",
           stdout=api.raw_io.output_text("13.5.1"),
       ),
-      api.properties(**{'$flutter/osx_sdk': {'sdk_version': 'deadbeef',}}),
+      api.properties(**{'$flutter/osx_sdk': {
+          'sdk_version': 'deadbeef',
+      }}),
       api.path.exists(sdk_app_path),
       api.step_data(
           'install xcode.verify xcode [CACHE]/osx_sdk/xcode_deadbeef/XCode.app.check xcode version',
@@ -548,11 +578,12 @@
       api.step_data('install xcode.install xcode from cipd', retcode=1),
   )
 
-  _MOCK_TIME_RECENT = "2023-12-13 13:43:21"
-  _MOCK_TIME_LONG_AGO = "2023-12-01 13:43:21"
+  _MOCK_TIME_WITHIN_7_DAYS = "2023-12-13 13:43:21"
+  _MOCK_TIME_WITHIN_1_DAY = "2023-12-15 00:00:00"
+  _MOCK_TIME_LONGER_THAN_7_DAYS = "2023-12-01 13:43:21"
 
   yield api.test(
-      'launch_services_unresponsive_mac_recently_reset',
+      'launch_services_unresponsive_mac_reset_within_a_day',
       api.platform.name('mac'),
       api.step_data(
           "find macOS version",
@@ -577,41 +608,75 @@
       api.step_data(
           'verify launch services.Check if Launch Services db has been reset recently',
           api.file.read_text(
-              text_content=(_MOCK_TIME_LONG_AGO + '\n' + _MOCK_TIME_RECENT)
+              text_content=(
+                  _MOCK_TIME_LONGER_THAN_7_DAYS + '\n' + _MOCK_TIME_WITHIN_1_DAY
+              )
           )
       ),
   )
 
   yield api.test(
-        'launch_services_unresponsive_mac_reset_long_ago',
-        api.platform.name('mac'),
-        api.step_data(
-            "find macOS version",
-            stdout=api.raw_io.output_text("13.5.1"),
-        ),
-        api.properties(**{'$flutter/osx_sdk': {
-            'sdk_version': 'deadbeef',
-        }}),
-        api.path.exists(
-            (sdk_app_path),
-            (api.path.cache_dir / 'osx_sdk/launch_services_reset_log.txt'),
-        ),
-        api.step_data(
-            'verify launch services.Check if xcodebuild impacted by Launch Services',
-            stdout=api.raw_io.output_text(
-                'Timestamp               Ty Process[PID:TID]\n' +
-                '2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb\n'
-                +
-                '2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb'
-            )
-        ),
-        api.step_data(
-            'verify launch services.Check if Launch Services db has been reset recently',
-            api.file.read_text(
-                text_content=_MOCK_TIME_LONG_AGO
-            )
-        ),
-    )
+      'launch_services_unresponsive_mac_reset_within_7_days',
+      api.platform.name('mac'),
+      api.step_data(
+          "find macOS version",
+          stdout=api.raw_io.output_text("13.5.1"),
+      ),
+      api.properties(**{'$flutter/osx_sdk': {
+          'sdk_version': 'deadbeef',
+      }}),
+      api.path.exists(
+          (sdk_app_path),
+          (api.path.cache_dir / 'osx_sdk/launch_services_reset_log.txt'),
+      ),
+      api.step_data(
+          'verify launch services.Check if xcodebuild impacted by Launch Services',
+          stdout=api.raw_io.output_text(
+              'Timestamp               Ty Process[PID:TID]\n' +
+              '2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb\n'
+              +
+              '2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb'
+          )
+      ),
+      api.step_data(
+          'verify launch services.Check if Launch Services db has been reset recently',
+          api.file.read_text(
+              text_content=(
+                  _MOCK_TIME_LONGER_THAN_7_DAYS + '\n' +
+                  _MOCK_TIME_WITHIN_7_DAYS
+              )
+          )
+      ),
+  )
+
+  yield api.test(
+      'launch_services_unresponsive_mac_reset_longer_than_7_days',
+      api.platform.name('mac'),
+      api.step_data(
+          "find macOS version",
+          stdout=api.raw_io.output_text("13.5.1"),
+      ),
+      api.properties(**{'$flutter/osx_sdk': {
+          'sdk_version': 'deadbeef',
+      }}),
+      api.path.exists(
+          (sdk_app_path),
+          (api.path.cache_dir / 'osx_sdk/launch_services_reset_log.txt'),
+      ),
+      api.step_data(
+          'verify launch services.Check if xcodebuild impacted by Launch Services',
+          stdout=api.raw_io.output_text(
+              'Timestamp               Ty Process[PID:TID]\n' +
+              '2025-01-25 22:47:00.906 E  xcodebuild[11687:149bd] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.modifydb\n'
+              +
+              '2025-01-25 22:47:00.906 E  xcodebuild[11687:149c6] [com.apple.launchservices:default] LaunchServices: disconnect event interruption received for service com.apple.lsd.mapdb'
+          )
+      ),
+      api.step_data(
+          'verify launch services.Check if Launch Services db has been reset recently',
+          api.file.read_text(text_content=_MOCK_TIME_LONGER_THAN_7_DAYS)
+      ),
+  )
 
   yield api.test(
       'launch_services_unresponsive_mac_already_reset_invalid date',