@@ -378,6 +378,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory, Configur
378378
379379 private Map <String , String > lastRemoteDefaultExecProperties ;
380380 private RemoteOutputsMode lastRemoteOutputsMode ;
381+ private Boolean lastRemoteCacheEnabled ;
381382
382383 class PathResolverFactoryImpl implements PathResolverFactory {
383384 @ Override
@@ -1727,10 +1728,25 @@ private void deleteActionsIfRemoteOptionsChanged(OptionsProvider options)
17271728 lastRemoteDefaultExecProperties != null
17281729 && !remoteDefaultExecProperties .equals (lastRemoteDefaultExecProperties );
17291730 lastRemoteDefaultExecProperties = remoteDefaultExecProperties ;
1731+
1732+ boolean remoteCacheEnabled = remoteOptions != null && remoteOptions .isRemoteCacheEnabled ();
1733+ // If we have remote metadata from last build, and the remote cache is not
1734+ // enabled in this build, invalidate actions since they can't download those
1735+ // remote files.
1736+ //
1737+ // TODO(chiwang): Re-evaluate this after action rewinding is implemented in
1738+ // Bazel since we can treat that case as lost inputs.
1739+ if (lastRemoteOutputsMode != RemoteOutputsMode .ALL ) {
1740+ needsDeletion |=
1741+ lastRemoteCacheEnabled != null && lastRemoteCacheEnabled && !remoteCacheEnabled ;
1742+ }
1743+ lastRemoteCacheEnabled = remoteCacheEnabled ;
1744+
17301745 RemoteOutputsMode remoteOutputsMode =
17311746 remoteOptions != null ? remoteOptions .remoteOutputsMode : RemoteOutputsMode .ALL ;
17321747 needsDeletion |= lastRemoteOutputsMode != null && lastRemoteOutputsMode != remoteOutputsMode ;
17331748 this .lastRemoteOutputsMode = remoteOutputsMode ;
1749+
17341750 if (needsDeletion ) {
17351751 memoizingEvaluator .delete (k -> SkyFunctions .ACTION_EXECUTION .equals (k .functionName ()));
17361752 }
0 commit comments