Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 6, 2025

This PR fixes an issue where local nbextensions could not be found when kernels were launched from local kernelspecs, even when those kernelspecs had an associated Python interpreter with nbextensions installed.

Problem

The NbExtensionsPathProvider was missing a case for handling 'startUsingLocalKernelSpec' kernel connections. This caused the provider to always return undefined for local kernelspec-based kernels, resulting in the error message "No nbextensions folder found for kernel" and preventing widgets from working when CDN access was unavailable.

Root Cause

The switch statement in NbExtensionsPathProvider.node.ts only handled:

  • 'startUsingPythonInterpreter' → returns sysPrefix/share/jupyter
  • 'connectToLiveRemoteKernel' and 'startUsingRemoteKernelSpec' → returns baseUrl
  • default → returns undefined

Local kernelspecs ('startUsingLocalKernelSpec') fell through to the default case and always returned undefined, even when they had an associated Python interpreter.

Solution

Added a new case for 'startUsingLocalKernelSpec' that:

  1. Checks if the kernelspec has an associated Python interpreter
  2. If yes, uses the same logic as 'startUsingPythonInterpreter' to return sysPrefix/share/jupyter
  3. If no interpreter, returns undefined (maintaining existing behavior for non-Python kernels)

Testing

  • Added comprehensive test coverage for the new case
  • Verified all existing tests continue to pass
  • Confirmed the fix works for both Node.js and Web environments appropriately

This change is minimal, safe, and maintains backward compatibility while fixing the specific scenario described in the issue.

Fixes #16823.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 0.0.0.123
    • Triggering command: node /home/REDACTED/work/vscode-jupyter/vscode-jupyter/node_modules/.bin/mocha --config ./build/.mocha.unittests.js.json ./out/interactive-window/generatedCodeStorageManager.unit.test.js ./out/interactive-window/shiftEnterBanner.unit.test.js ./out/kernels/helpers.unit.test.js ./out/kernels/kernelAutoReConnectMonitor.unit.test.js ./out/kernels/kernelAutoRestartMonitor.unit.test.js ./out/kernels/kernelCrashMonitor.unit.test.js ./out/kernels/kernelDependencyService.unit.test.js ./out/kernels/kernelFinder.unit.test.js ./out/kernels/kernelProvider.node.unit.test.js ./out/kernels/kernelProvider.web.unit.test.js ./out/kernels/kernelRefreshIndicator.node.unit.test.js ./out/kernels/kernelRefreshIndicator.web.unit.test.js ./out/test/package.nls.json.unit.test.js out/**/ipyWidgetScriptSourceProvider.unit.test.js (packet block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Local nbextensions can't be found for kernel launched from local kernelspec Fix local nbextensions path resolution for kernels launched from local kernelspec Aug 6, 2025
@Copilot Copilot AI requested a review from DonJayamanne August 6, 2025 23:24
Copilot finished work on behalf of DonJayamanne August 6, 2025 23:24
@DonJayamanne
Copy link
Contributor

@copilot there are some formatting errors, run npm run format-fix and commit the changes

Copy link
Contributor Author

Copilot AI commented Aug 7, 2025

@copilot there are some formatting errors, run npm run format-fix and commit the changes

Fixed formatting errors with npm run format-fix. The trailing whitespace in the comment has been removed. (02d065c)

@Copilot Copilot AI requested a review from DonJayamanne August 7, 2025 02:26
Copilot finished work on behalf of DonJayamanne August 7, 2025 02:26
@DonJayamanne DonJayamanne marked this pull request as ready for review August 7, 2025 03:16
@vs-code-engineering vs-code-engineering bot added this to the August 2025 milestone Aug 7, 2025
@DonJayamanne DonJayamanne enabled auto-merge (squash) August 7, 2025 04:57
@DonJayamanne DonJayamanne merged commit 8daf5f7 into main Aug 7, 2025
25 checks passed
@DonJayamanne DonJayamanne deleted the copilot/fix-16823 branch August 7, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local nbextensions can't be found for kernel launched from local kernelspec
4 participants