diff --git a/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.ts index f7a74e4c27e32..d59a4ed460995 100644 --- a/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.ts @@ -50,7 +50,9 @@ export class NotebookExecutionService implements INotebookExecutionService, IDis } let kernel = this._notebookKernelService.getSelectedOrSuggestedKernel(notebook); - if (!kernel) { + const noPendingKernelDetections = this._notebookKernelService.getKernelDetectionTasks(notebook).length === 0; + // do not auto run source action when there is pending kernel detections + if (!kernel && noPendingKernelDetections) { kernel = await this.resolveSourceActions(notebook, contextKeyService); }