checkout: Use 'git submodule sync' more
Run 'git submodule sync' before 'git submodule update' calls. It's
possible there's been an update to the '.gitmodules' file and we need to
point submodules to new remotes before updating.
Bug: b/387533587
Change-Id: I4209deadc97b0cdc10e1e20c34727c8eb5af8622
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/257835
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/bazel_roll/tests/retrieve_attributes.expected/success.json b/recipe_modules/bazel_roll/tests/retrieve_attributes.expected/success.json
index 67ffe06..66058f6 100644
--- a/recipe_modules/bazel_roll/tests/retrieve_attributes.expected/success.json
+++ b/recipe_modules/bazel_roll/tests/retrieve_attributes.expected/success.json
@@ -171,6 +171,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-super",
+    "infra_step": true,
+    "name": "checkout super.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout super.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/bazel_roll/tests/update_value.expected/equiv.json b/recipe_modules/bazel_roll/tests/update_value.expected/equiv.json
index b3766fd..3a0e0da 100644
--- a/recipe_modules/bazel_roll/tests/update_value.expected/equiv.json
+++ b/recipe_modules/bazel_roll/tests/update_value.expected/equiv.json
@@ -171,6 +171,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-super",
+    "infra_step": true,
+    "name": "checkout super.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout super.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/bazel_roll/tests/update_value.expected/multiple-2.json b/recipe_modules/bazel_roll/tests/update_value.expected/multiple-2.json
index cfbf6b8..f1a2438 100644
--- a/recipe_modules/bazel_roll/tests/update_value.expected/multiple-2.json
+++ b/recipe_modules/bazel_roll/tests/update_value.expected/multiple-2.json
@@ -171,6 +171,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-super",
+    "infra_step": true,
+    "name": "checkout super.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout super.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/bazel_roll/tests/update_value.expected/multiple.json b/recipe_modules/bazel_roll/tests/update_value.expected/multiple.json
index f73aa19..433f33e 100644
--- a/recipe_modules/bazel_roll/tests/update_value.expected/multiple.json
+++ b/recipe_modules/bazel_roll/tests/update_value.expected/multiple.json
@@ -171,6 +171,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-super",
+    "infra_step": true,
+    "name": "checkout super.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout super.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/bazel_roll/tests/update_value.expected/success.json b/recipe_modules/bazel_roll/tests/update_value.expected/success.json
index 017edd2..3dd76e3 100644
--- a/recipe_modules/bazel_roll/tests/update_value.expected/success.json
+++ b/recipe_modules/bazel_roll/tests/update_value.expected/success.json
@@ -171,6 +171,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-super",
+    "infra_step": true,
+    "name": "checkout super.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout super.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index 5151db3..5df25df 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -906,6 +906,7 @@
                     # See b/243673776 for why we detach before updating
                     # submodules.
                     self.m.git('detach', 'checkout', '--detach')
+                    self.m.git.submodule_sync(recursive=True)
                     self.m.git.submodule_update(
                         recursive=True,
                         timeout=ctx.options.submodule_timeout_sec,
@@ -1081,8 +1082,8 @@
                         with self.m.step.nest(f'including submodule {sub}'):
                             pass
 
+                    self.m.git.submodule_sync(recursive=True, **kwargs)
                     if submodules or submodule_paths:
-                        self.m.git.submodule_sync(recursive=True, **kwargs)
                         with self.m.default_timeout():
                             self.m.git.submodule_update(
                                 recursive=True,
@@ -1255,6 +1256,7 @@
                         submodule = matching_submodules[0]
                         if not ctx.options.initialize_submodules:
                             with self.m.default_timeout():
+                                self.m.git.submodule_sync(recursive=True)
                                 self.m.git.submodule_update(
                                     paths=(submodule.path,)
                                 )
diff --git a/recipe_modules/checkout/tests/git.expected/ci.json b/recipe_modules/checkout/tests/git.expected/ci.json
index 3a3bb1c..de3f1ac 100644
--- a/recipe_modules/checkout/tests/git.expected/ci.json
+++ b/recipe_modules/checkout/tests/git.expected/ci.json
@@ -1199,6 +1199,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/git.expected/not_in_gerrit.json b/recipe_modules/checkout/tests/git.expected/not_in_gerrit.json
index 38bfe71..81629cd 100644
--- a/recipe_modules/checkout/tests/git.expected/not_in_gerrit.json
+++ b/recipe_modules/checkout/tests/git.expected/not_in_gerrit.json
@@ -772,6 +772,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:0.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/git.expected/other.json b/recipe_modules/checkout/tests/git.expected/other.json
index a1cce58..d18c802 100644
--- a/recipe_modules/checkout/tests/git.expected/other.json
+++ b/recipe_modules/checkout/tests/git.expected/other.json
@@ -778,6 +778,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/git.expected/trigger.json b/recipe_modules/checkout/tests/git.expected/trigger.json
index 085e452..772417b 100644
--- a/recipe_modules/checkout/tests/git.expected/trigger.json
+++ b/recipe_modules/checkout/tests/git.expected/trigger.json
@@ -1251,6 +1251,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/git.expected/try.json b/recipe_modules/checkout/tests/git.expected/try.json
index 6535dc2..a9c59a7 100644
--- a/recipe_modules/checkout/tests/git.expected/try.json
+++ b/recipe_modules/checkout/tests/git.expected/try.json
@@ -1339,6 +1339,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/ci.json b/recipe_modules/checkout/tests/repo.expected/ci.json
index 203cfe0..5b7fbb4 100644
--- a/recipe_modules/checkout/tests/repo.expected/ci.json
+++ b/recipe_modules/checkout/tests/repo.expected/ci.json
@@ -432,6 +432,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/.repo/manifests",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/feature_branches_ci.json b/recipe_modules/checkout/tests/repo.expected/feature_branches_ci.json
index 4ed37c2..fadf330 100644
--- a/recipe_modules/checkout/tests/repo.expected/feature_branches_ci.json
+++ b/recipe_modules/checkout/tests/repo.expected/feature_branches_ci.json
@@ -983,6 +983,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pinned",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/feature_branches_try.json b/recipe_modules/checkout/tests/repo.expected/feature_branches_try.json
index 60546e5..56a4299 100644
--- a/recipe_modules/checkout/tests/repo.expected/feature_branches_try.json
+++ b/recipe_modules/checkout/tests/repo.expected/feature_branches_try.json
@@ -1146,6 +1146,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/feature_branches_try_multiple_features.json b/recipe_modules/checkout/tests/repo.expected/feature_branches_try_multiple_features.json
index 164b23e..1b25d36 100644
--- a/recipe_modules/checkout/tests/repo.expected/feature_branches_try_multiple_features.json
+++ b/recipe_modules/checkout/tests/repo.expected/feature_branches_try_multiple_features.json
@@ -1258,6 +1258,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1624,6 +1650,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/default_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply default:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/feature_branches_try_no_matching.json b/recipe_modules/checkout/tests/repo.expected/feature_branches_try_no_matching.json
index 40e6dac..9cd43c2 100644
--- a/recipe_modules/checkout/tests/repo.expected/feature_branches_try_no_matching.json
+++ b/recipe_modules/checkout/tests/repo.expected/feature_branches_try_no_matching.json
@@ -1167,6 +1167,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1533,6 +1559,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/default_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply default:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/no_trigger.json b/recipe_modules/checkout/tests/repo.expected/no_trigger.json
index d0cc015..68f6c48 100644
--- a/recipe_modules/checkout/tests/repo.expected/no_trigger.json
+++ b/recipe_modules/checkout/tests/repo.expected/no_trigger.json
@@ -432,6 +432,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/.repo/manifests",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/prefix.json b/recipe_modules/checkout/tests/repo.expected/prefix.json
index 69608f3..f30f6e4 100644
--- a/recipe_modules/checkout/tests/repo.expected/prefix.json
+++ b/recipe_modules/checkout/tests/repo.expected/prefix.json
@@ -1093,6 +1093,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/prefix/suffix",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply foo:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/try-multiple-cqdeps.json b/recipe_modules/checkout/tests/repo.expected/try-multiple-cqdeps.json
index 2d5c3ea..f0035ee 100644
--- a/recipe_modules/checkout/tests/repo.expected/try-multiple-cqdeps.json
+++ b/recipe_modules/checkout/tests/repo.expected/try-multiple-cqdeps.json
@@ -1396,6 +1396,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1762,6 +1788,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/default_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply default:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/try-multiple-onenotapplied.json b/recipe_modules/checkout/tests/repo.expected/try-multiple-onenotapplied.json
index 692da53..8e2079d 100644
--- a/recipe_modules/checkout/tests/repo.expected/try-multiple-onenotapplied.json
+++ b/recipe_modules/checkout/tests/repo.expected/try-multiple-onenotapplied.json
@@ -1242,6 +1242,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1608,6 +1634,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/default_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply default:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/try-multiple.json b/recipe_modules/checkout/tests/repo.expected/try-multiple.json
index d4a9fbc..b11e030 100644
--- a/recipe_modules/checkout/tests/repo.expected/try-multiple.json
+++ b/recipe_modules/checkout/tests/repo.expected/try-multiple.json
@@ -1167,6 +1167,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1533,6 +1559,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/default_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply default:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/try.json b/recipe_modules/checkout/tests/repo.expected/try.json
index b5a7ad9..dd43ee6 100644
--- a/recipe_modules/checkout/tests/repo.expected/try.json
+++ b/recipe_modules/checkout/tests/repo.expected/try.json
@@ -1095,6 +1095,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/pigweed_path",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/repo.expected/try_manifest.json b/recipe_modules/checkout/tests/repo.expected/try_manifest.json
index f0d1013..6b71f47 100644
--- a/recipe_modules/checkout/tests/repo.expected/try_manifest.json
+++ b/recipe_modules/checkout/tests/repo.expected/try_manifest.json
@@ -831,6 +831,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/.repo/manifests",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/insteadof.json b/recipe_modules/checkout/tests/submodule.expected/insteadof.json
index 5a15ce3..07a2f38 100644
--- a/recipe_modules/checkout/tests/submodule.expected/insteadof.json
+++ b/recipe_modules/checkout/tests/submodule.expected/insteadof.json
@@ -636,6 +636,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1328,6 +1355,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-ci.json b/recipe_modules/checkout/tests/submodule.expected/submodule-ci.json
index a3bb17f..a4c8d54 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-ci.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-ci.json
@@ -467,6 +467,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -986,6 +1013,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1266,6 +1319,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/baz",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-not-initialized.json b/recipe_modules/checkout/tests/submodule.expected/submodule-not-initialized.json
index 3c7e27b..92fb90b 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-not-initialized.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-not-initialized.json
@@ -467,6 +467,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-match.json b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-match.json
index cdf7e89..7675dcc 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-match.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-match.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1058,6 +1085,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1391,6 +1444,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo1",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-nomatch.json b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-nomatch.json
index 715b33a..ae26d05 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-nomatch.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-nomatch.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-twomatch.json b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-twomatch.json
index 501c296..e79d83d 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-twomatch.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-repeated-twomatch.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-equivalent.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-equivalent.json
index bbd0b1e..246720d 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-equivalent.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-equivalent.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1096,6 +1123,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1429,6 +1482,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply z:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-excluded.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-excluded.json
index 3387b73..41a3850 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-excluded.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-excluded.json
@@ -1212,6 +1212,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-included.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-included.json
index a36bd25..727db70 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-included.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-included.json
@@ -1179,6 +1179,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-cqdeps.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-cqdeps.json
index 4d09f8e..d41809c 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-cqdeps.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-cqdeps.json
@@ -1025,6 +1025,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1717,6 +1744,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:3456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1901,6 +1954,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -2234,6 +2313,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -2325,6 +2430,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync (2)",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -2658,6 +2789,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/bar",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing-one-forbidden-cqdeps.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing-one-forbidden-cqdeps.json
index 49fa738..ec121c3 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing-one-forbidden-cqdeps.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing-one-forbidden-cqdeps.json
@@ -1126,6 +1126,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1818,6 +1845,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:3456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -2002,6 +2055,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -2335,6 +2414,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing.json
index ef68314..f435956 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple-one-missing.json
@@ -726,6 +726,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1418,6 +1445,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:3456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1602,6 +1655,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1935,6 +2014,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple.json
index 9105e2d..6b437f6 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-multiple.json
@@ -725,6 +725,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1417,6 +1444,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:3456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -1601,6 +1654,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1934,6 +2013,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/foo",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
@@ -2025,6 +2130,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync (2)",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -2358,6 +2489,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/bar",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:2345.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try-not-found.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try-not-found.json
index a4d641d..b82a84a 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try-not-found.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try-not-found.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipe_modules/checkout/tests/submodule.expected/submodule-try.json b/recipe_modules/checkout/tests/submodule.expected/submodule-try.json
index c74881f..8207b4e 100644
--- a/recipe_modules/checkout/tests/submodule.expected/submodule-try.json
+++ b/recipe_modules/checkout/tests/submodule.expected/submodule-try.json
@@ -577,6 +577,33 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
@@ -1096,6 +1123,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--jobs",
@@ -1429,6 +1482,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/baz",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply x:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/checkout/tests/workspace.expected/found.json b/recipe_modules/checkout/tests/workspace.expected/found.json
index 4758741..7bba1aa 100644
--- a/recipe_modules/checkout/tests/workspace.expected/found.json
+++ b/recipe_modules/checkout/tests/workspace.expected/found.json
@@ -2052,6 +2052,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/bazel_repos/pigweed_pigweed_pigweed.git",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout foo.workspace.pigweed:123456.WORKSPACE.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@5@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipe_modules/cipd_upload/tests/manifest.expected/manifest.json b/recipe_modules/cipd_upload/tests/manifest.expected/manifest.json
index ff314c5..e162a7c 100644
--- a/recipe_modules/cipd_upload/tests/manifest.expected/manifest.json
+++ b/recipe_modules/cipd_upload/tests/manifest.expected/manifest.json
@@ -197,6 +197,21 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+    "infra_step": true,
+    "name": "checkout pigweed.cache.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
     "cmd": [],
     "name": "checkout pigweed.cache.timeout 10s (2)",
     "~followup_annotations": [
diff --git a/recipes/target_to_cipd.expected/pw-presubmit.json b/recipes/target_to_cipd.expected/pw-presubmit.json
index e423927..72bfaab 100644
--- a/recipes/target_to_cipd.expected/pw-presubmit.json
+++ b/recipes/target_to_cipd.expected/pw-presubmit.json
@@ -778,6 +778,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/target_to_cipd.expected/success.json b/recipes/target_to_cipd.expected/success.json
index 141be12..0e053f3 100644
--- a/recipes/target_to_cipd.expected/success.json
+++ b/recipes/target_to_cipd.expected/success.json
@@ -615,6 +615,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co/.repo/manifests",
+    "luci_context": {
+      "realm": {
+        "name": "project:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/tokendb_check.expected/addition.json b/recipes/tokendb_check.expected/addition.json
index 37113c8..e30f273 100644
--- a/recipes/tokendb_check.expected/addition.json
+++ b/recipes/tokendb_check.expected/addition.json
@@ -1487,6 +1487,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/tokendb_check.expected/no-change.json b/recipes/tokendb_check.expected/no-change.json
index 2095fda..476a7e6 100644
--- a/recipes/tokendb_check.expected/no-change.json
+++ b/recipes/tokendb_check.expected/no-change.json
@@ -1487,6 +1487,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/tokendb_check.expected/removal.json b/recipes/tokendb_check.expected/removal.json
index 3f2ab0e..53473e3 100644
--- a/recipes/tokendb_check.expected/removal.json
+++ b/recipes/tokendb_check.expected/removal.json
@@ -1487,6 +1487,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/tokendb_check.expected/update.json b/recipes/tokendb_check.expected/update.json
index fb437ba..c3d630b 100644
--- a/recipes/tokendb_check.expected/update.json
+++ b/recipes/tokendb_check.expected/update.json
@@ -1487,6 +1487,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/update_python_versions.expected/simple.json b/recipes/update_python_versions.expected/simple.json
index acdc1a1..81afb5b 100644
--- a/recipes/update_python_versions.expected/simple.json
+++ b/recipes/update_python_versions.expected/simple.json
@@ -778,6 +778,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/xrefs.expected/dry_run.json b/recipes/xrefs.expected/dry_run.json
index 818c0a8..571c361 100644
--- a/recipes/xrefs.expected/dry_run.json
+++ b/recipes/xrefs.expected/dry_run.json
@@ -778,6 +778,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/xrefs.expected/kythe.json b/recipes/xrefs.expected/kythe.json
index 9d40492..103f9e7 100644
--- a/recipes/xrefs.expected/kythe.json
+++ b/recipes/xrefs.expected/kythe.json
@@ -778,6 +778,20 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "name": "checkout pigweed.apply pigweed:1234.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",
diff --git a/recipes/xrefs.expected/tryjob.json b/recipes/xrefs.expected/tryjob.json
index 9a864f0..2a92dd7 100644
--- a/recipes/xrefs.expected/tryjob.json
+++ b/recipes/xrefs.expected/tryjob.json
@@ -1362,6 +1362,32 @@
     "cmd": [
       "git",
       "submodule",
+      "sync",
+      "--recursive"
+    ],
+    "cwd": "[START_DIR]/co",
+    "luci_context": {
+      "realm": {
+        "name": "project:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "checkout pigweed.apply pigweed:123456.git submodule sync",
+    "timeout": 600.0,
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
       "update",
       "--init",
       "--recursive",