fix(labextension): don't block JupyterLab startup with async kernel init#810
Draft
Copilot wants to merge 2 commits into
Draft
fix(labextension): don't block JupyterLab startup with async kernel init#810Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…cked The activate() function was async and awaited heavy kernel operations (createNewKernel, getBackend, log.setup_logging) before returning. Because @lumino/application awaits all autoStart plugin activate() Promises before calling shell.attach() (which creates the #main element), this caused JupyterLab's browser_check to time out after 100 s waiting for '#main'. Fix: - Make activate() return immediately (non-blocking) by launching kernel init as a background IIFE (initializationPromise). - Move getBackend() to module scope. - SettingsAwareLeftPanel component now subscribes to initializationPromise via React state, rendering null until the kernel is ready, then rendering the full panel. - lab.started.then() is synchronous: creates the widget and calls restorer.add() at the correct time (before lab.restored), preserving layout-restoration behaviour across page reloads. - lab.restored.then() awaits initializationPromise to run the resume- notebook-path logic once the kernel is available. - Remove erroneous `throw error` in the log.setup_logging catch block which would have caused activate() to reject and crash JupyterLab startup.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions job for Kale Jupyter Labextension
fix(labextension): don't block JupyterLab startup with async kernel init
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@lumino/applicationawaits all autoStart pluginactivate()promises before callingshell.attach()(which creates#main). Kale'sactivate()wasasyncand awaited kernel creation + backend checks (~2–100s), so#mainnever appeared withinbrowser_check's 100s timeout.Changes
initializationPromise) —activate()returns immediately without blockingshell.attach()SettingsAwareLeftPanelis async-aware: subscribes toinitializationPromiseviauseEffect/React state; rendersnulluntil the kernel is ready, then renders the full panellab.started.then()is now synchronous — widget is created andrestorer.add()is called beforelab.restoredfires, keeping layout persistence across page reloads intactlab.restored.then()still awaitsinitializationPromisesonb.resume_notebook_pathonly runs once the kernel is availablethrow errorin thelog.setup_loggingcatch block that would have causedactivate()to reject and crash JupyterLab startup