Repository navigation
feat(ipynb): create a .venv when pip is locked out, and show ipykernel setup progress - #22710
Conversation
…and show install progress in the dialog
There was a problem hiding this comment.
Important
pnpm run verify:localization-catalog — a step in the PR CI workflow (.github/workflows/pr.yml:213) — fails on this branch. Deleting auto.components.editor.IpynbViewer.installFailed from en.json leaves stale copies of that key in fr.json, ja.json, ko.json, and zh.json; the verifier rejects any locale key absent from en.json.
Reviewed changes
- PEP 668 detection in the kernel bridge —
kernel-bridge.pygainsexternally_managed(), which mirrors pip's own check (sys.prefix != base_prefix,EXTERNALLY-MANAGEDundersysconfig.get_path("stdlib")), and reports it on themissingframe. - Venv creation path — new
notebook:createVenvIPC handler andcreateNotebookVenv(create.venv, install ipykernel, describe it), plusnotebookVenvParent/venvInterpreterPathinsrc/shared. - Renderer flow — new
IpynbKernelSetupDialogreplaces the inline dialog;installIpykernel/createVirtualEnvironmentkeep the dialog open with progress and surface failures throughsetupError; newcreating-venvstatus plusexternallyManaged/setupErrorsession fields. - Command helpers —
ipykernelInstallCommandandvenvSetupCommandmove toipynb-kernel-setup-commands.tswith POSIX/PowerShell quoting. - Tests — frame parsing,
createNotebookVenv, venv location, session install/venv flows, and the toolbar cancel path.
⚠️ verify:localization-catalog fails: stale installFailed entries in four locales
This PR removes auto.components.editor.IpynbViewer.installFailed from en.json (it is no longer referenced anywhere), but fr.json, ja.json, ko.json, and zh.json still carry the key. verify-localization-catalog.mjs treats any locale key missing from en.json as an error (extraInLocale) and aborts the whole check on the first offender:
Locale catalog validation failed for fr.json.
extra: auto.components.editor.IpynbViewer.installFailed
Fix or retire the existing target entry in a localization PR.
The CI step will stay red until those four entries are retired.
Technical details
# Retire the orphaned IpynbViewer.installFailed entries
## Affected sites
- src/renderer/src/i18n/locales/fr.json:15030 — `auto.components.editor.IpynbViewer.installFailed`
- src/renderer/src/i18n/locales/ja.json:14927 — same key
- src/renderer/src/i18n/locales/ko.json:14927 — same key
- src/renderer/src/i18n/locales/zh.json:14927 — same key
## Required outcome
- `pnpm run verify:localization-catalog` passes: no locale entry exists that `en.json` lacks.
## Suggested approach
- Delete the four `installFailed` entries. Keeping the `en.json` key would also satisfy the gate, but the string is now dead copy.
</details>
### ℹ️ Nitpicks
- No test covers the new `notebook:createVenv` handler in `src/main/ipc/notebook.test.ts`, which already exercises the other handlers (including their authorization calls).
<!--
Pullfrog review metadata. These findings were written against b898395;
if commits have landed on ipynb-kernel-setup since, treat every specific bug, file, or
line callout as POTENTIALLY STALE and re-diff before acting on it.
- Mode: Review (initial)
- Files reviewed: 19
- Commits reviewed: 1
- Base: main (c4e58fa)
- Head: ipynb-kernel-setup (b898395)
- Reviewed commits:
- b898395 — feat(ipynb): set up ipykernel in a new .venv when pip is locked out, and show install progress in the dialog
- Prior pullfrog review: none
-->
<!-- PULLFROG_DIVIDER_DO_NOT_REMOVE_PLZ -->
<sup><a href="https://pullfrog.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pullfrog.com/logos/frog-white-full-18px.png"><img src="https://pullfrog.com/logos/frog-green-full-18px.png" width="9px" height="9px" style="vertical-align: middle; " alt="Pullfrog"></picture></a> | [Fix all ➔](https://pullfrog.com/trigger/stablyai/orca/22710?action=fix&review_id=5308946776) | [Fix 👍s ➔](https://pullfrog.com/trigger/stablyai/orca/22710?action=fix-approved&review_id=5308946776) | [View workflow run](https://github.com/stablyai/orca/actions/runs/36045197087/job/107786924931) | Using `DeepSeek Flash` (free via [Pullfrog for OSS](https://pullfrog.com/for-oss)) | [𝕏](https://x.com/pullfrogai)</sup>|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe kernel bridge now reports whether a missing ipykernel is associated with an externally managed Python environment. The main process and preload API add notebook virtual-environment creation, including ipykernel installation and import checks. Renderer session state tracks setup progress and errors. The toolbar and setup dialog expose installation and virtual-environment actions. Merge Risk: 🔵 Low · up to Cells queued while creating a virtual environment can be silently skipped. This is a narrow, recoverable issue, but queued execution should be preserved before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d6ceac04-23db-498b-9de2-1ebeb8d20083
📒 Files selected for processing (19)
resources/notebook/kernel-bridge.pysrc/main/ipc/notebook.tssrc/main/notebook/notebook-kernel.test.tssrc/main/notebook/notebook-kernel.tssrc/main/notebook/python-environments.test.tssrc/main/notebook/python-environments.tssrc/preload/api/filesystem-api.tssrc/preload/api/notebook-bridge.tssrc/renderer/src/components/editor/IpynbKernelSetupDialog.tsxsrc/renderer/src/components/editor/IpynbKernelToolbar.tsxsrc/renderer/src/components/editor/ipynb-kernel-runs.tssrc/renderer/src/components/editor/ipynb-kernel-session.test.tssrc/renderer/src/components/editor/ipynb-kernel-session.tssrc/renderer/src/components/editor/ipynb-kernel-setup-commands.tssrc/renderer/src/components/editor/ipynb-kernel-store.tssrc/renderer/src/i18n/locales/en.jsonsrc/shared/notebook-kernel-types.tssrc/shared/notebook-venv-location.test.tssrc/shared/notebook-venv-location.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
ℹ️ No new issues. The localization-catalog retirements landed cleanly and the previously blocking finding is resolved; the two nitpicks from the prior review remain open.
Reviewed changes
- Removed the orphaned
auto.components.editor.IpynbViewer.installFailedentry fromfr.json,ja.json,ko.json, andzh.json, clearing theverify:localization-catalogfailure flagged in the prior review.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…iew findings - Kernel status now only describes the kernel; a single `setup` object (base, offer, phase, error) drives the dialog, replacing the extra statuses and the externallyManaged/setupError fields. - The picker's 'Create virtual environment…' opens the same dialog; success switches through selectEnvironment, so a running kernel is only replaced once the venv exists. - Async setup results are dropped when the dialog they belong to is gone (tab closed/reopened). - main verifies ipykernel imports after pip, reuses an existing .venv instead of re-running venv over it, and explains failures that printed nothing. - Windows copy command guards the install with if ($?); notebooks at a filesystem root get a correct .venv parent; 'Try again' shows for both retry paths.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the setup-state refactor in db3cc70 — the commit that collapsed the ad-hoc kernel statuses into a single setup object and fixed the findings from the earlier reviews.
- Collapsed setup states into one object —
missing-ipykernel/installing/creating-venvplus the flatexternallyManaged/setupErrorfields are nowsetup: KernelSetup | null(base,offer,phase,error);statusstaysoffwhile a setup is pending andrunCellswaits onsetup. - Fixed both prior nitpicks — the dialog button label is now
error && !working ? 'Try again' : copy.action, so a failed venv shows "Try again" too, and the picker's venv item no longer falls back to the selected interpreter (venvBase = environments?.path[0]). - Verified installs in main —
installIpykernelrunspython -c 'import ipykernel, jupyter_client.manager'after pip, so "pip succeeded but it still won't load" surfaces as a dialog error;failureDetailexplains empty output by timeout / signal / exit code. - Reused existing
.venv—createNotebookVenvskipspython -m venvwhen the interpreter already exists, andnotebookVenvParentkeeps the root separator for a notebook at a filesystem root. - Command/copy cleanup —
getRendererAppPlatform()replaces the user-agent check, and the PowerShell venv command guards the install withif ($?).
Both prior Pullfrog threads are resolved. Tests (ipynb-kernel-session, IpynbKernelToolbar, ipynb-kernel-setup-commands, python-environments, notebook-venv-location — 27 passing), typecheck:web, typecheck:node, and verify:localization-catalog all pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bfc334a3-a144-4478-a6f8-627a18f447fb
📒 Files selected for processing (18)
src/main/notebook/notebook-kernel.test.tssrc/main/notebook/python-environments.test.tssrc/main/notebook/python-environments.tssrc/renderer/src/components/editor/IpynbKernelSetupDialog.tsxsrc/renderer/src/components/editor/IpynbKernelToolbar.test.tsxsrc/renderer/src/components/editor/IpynbKernelToolbar.tsxsrc/renderer/src/components/editor/ipynb-kernel-session.test.tssrc/renderer/src/components/editor/ipynb-kernel-session.tssrc/renderer/src/components/editor/ipynb-kernel-setup-commands.test.tssrc/renderer/src/components/editor/ipynb-kernel-setup-commands.tssrc/renderer/src/components/editor/ipynb-kernel-store.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/notebook-venv-location.test.tssrc/shared/notebook-venv-location.ts
💤 Files with no reviewable changes (4)
- src/renderer/src/i18n/locales/fr.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/notebook/python-environments.ts
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Preserve queued cells when creating a virtual environment from a… · ipynb-kernel-session.ts:248-250
src/renderer/src/components/editor/ipynb-kernel-session.ts:248-250
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPreserve queued cells when creating a virtual environment from a ready kernel.
If a cell is running when the setup dialog opens,
runCellsqueues later cells. Successful creation callsselectEnvironment, which restarts the ready kernel.stopRunsclears the queue, so those cells are lost instead of running in the new environment.Suggested fix
@@ -export function restartKernel(filePath: string): void { - updateSession(filePath, stopRuns) +export function restartKernel(filePath: string, keepQueue = false): void { + updateSession(filePath, (session) => ({ + ...stopRuns(session), + ...(keepQueue ? { queue: session.queue } : {}) + })) void start(filePath) } export function selectEnvironment(filePath: string, environment: PythonEnvironment): void { + const keepQueue = getSession(filePath).setup !== null setEnvironment(filePath, environment) @@ if (getSession(filePath).status === 'off') { void start(filePath) } else { - restartKernel(filePath) + restartKernel(filePath, keepQueue) } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 046a43c3-3123-4183-872f-6f975a4e770c
📒 Files selected for processing (2)
src/renderer/src/components/editor/ipynb-kernel-session.test.tssrc/renderer/src/components/editor/ipynb-kernel-session.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/editor/ipynb-kernel-session.ts
- src/renderer/src/components/editor/ipynb-kernel-session.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed bf8528cc — the only commit since the prior pullfrog review — which fixes the setup prompt lingering after a different interpreter is picked.
- Picking another Python closes the setup prompt —
selectEnvironmentnow clears an idlesetupright aftersetEnvironment, so themissing-ipykernel/Create a virtual environment?dialog closes when the user chooses a different interpreter and the waiting cells run there; if the newly picked interpreter also lacks ipykernel,startreopens the prompt. - In-flight setup is preserved — the
phase === 'idle'guard keeps the setup visible throughinstalling/creating-venv, includingcreateVirtualEnvironment's success path (which callsselectEnvironmentwhilecreating-venvand letsstartclear the setup on ready). - Regression test added — the new session test asserts
setup === nullafter the pick, checks the new interpreter'sstartKernelcall, and confirms the queued cell executes. ThetoBeNull()assertion fails against the pre-bf8528cccode, so it is a real regression test.
Both prior pullfrog threads on this PR are already resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
To run notebook cells, Python needs a package called ipykernel. When it was missing, Orca's popup offered an Install button that often couldn't work, and gave no sign of whether anything was happening. Now the popup shows the install as it runs and shows any error. When the Python won't accept installs at all (for example Homebrew's), Orca offers to create a private project environment with ipykernel and runs the notebook there.
What Changed
Before:
After:
kernel-bridge.py) also reports whether pip is blocked. It does this the way pip does: it looks for theEXTERNALLY-MANAGEDmarker file and skips the check inside a venv.python -m venv .venvin the workspace root, or next to the notebook if it's outside the workspace, installs ipykernel into it, switches the notebook to it, and runs the cells that were waiting.Why
VS Code's Jupyter extension (from
microsoft/vscode-jupyter) handles the same prompt:.venvand installs ipykernel. Orca now has the same entry.--userand fails the same way Orca's did.Checking for the marker file up front sends people straight to the step that works, instead of a failure and then a retry.
Alternatives I didn't take:
--break-system-packages: it can break the user's system Python, and pip warns against it.runProcessrunner. I left that for a later change; progress here is the phase (spinner plus status text), not pip's live output.Linked Issue
N/A. This is a follow-up to #22581.
Visual Proof
Before:
After: Homebrew Python, where pip is blocked:
After: while the environment is being created:
After: done, running in the new
.venv:Testing
Manual, macOS, dev build:
python3(3.14, pip blocked), ran a cell, and got the "Create a virtual environment?" dialog..venvwas created, ipykernel was installed, the kernel started in.venv, and the cell printedhello.python3reported blocked, while Apple's/usr/bin/python3and a fresh venv reported not blocked.Automated:
createNotebookVenvruns the venv step, then the install, then describes the new Python, and returns the error whenvenvfails.notebookVenvParentpicks the right folder.pnpm tc, the changed-code quality gate and oxlint pass.Not tested manually: Linux and Windows. The Windows paths go through
Scripts\python.exeand the PowerShell;separator, and are unit-tested.Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
resolveAuthorizedPath) before it runs anything..venv:python -m venvwithout--clearkeeps an existing.venvand only fills in missing pieces. The picker entry uses a Python from PATH as the base, not the currently selected one, so it never rebuilds a venv from its own interpreter.externallyManagedfield arrives together with the code that reads it. A missing field is read as "not blocked".Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)