feat(vscode): create empty notebooks via notebook_edit#11726
Merged
Conversation
added 2 commits
June 26, 2026 13:25
Add a create action to the notebook_edit tool so an agent can make a new empty .ipynb on disk, then insert cells. The VS Code notebook API has no way to create a notebook file at a path (openNotebookDocument only makes an unsaved untitled notebook), so the bridge writes a minimal valid empty .ipynb and opens it. Reuses the existing notebook_edit permission and native_notebook_tools experiment; .ipynb only for now, parent directory must already exist.
Contributor
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Files Reviewed (11 files)
Reviewed by gpt-5.4-20260305 · Input: 147.2K · Output: 12.7K · Cached: 369.2K Review guidance: REVIEW.md from base branch |
imanolmzd-svg
approved these changes
Jun 26, 2026
vkeerthivikram
pushed a commit
to vkeerthivikram/kilocode
that referenced
this pull request
Jun 30, 2026
…action feat(vscode): create empty notebooks via notebook_edit
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.
What changed
Adds a
createaction to thenotebook_edittool so an agent can create a new empty.ipynbon disk and theninsertcells into it. This closes the "creating a fresh notebook doesn't work well" limitation noted in #11644.packages/opencode/src/kilocode/): newcreateaction in the notebook protocol (EditRequest/EditResult),expected_revisionmade optional,already_existserror code.notebook_editacceptsaction: "create"with nokind/source/index/expected_revision, validates before the permission prompt, and returns the new notebook's initial revision.packages/kilo-vscode/src/services/notebook/):resolveNotebookCreatePathresolves the parent directory (must exist, inside the request root, pass access checks), rejects non-.ipynband already-existing files. The adapter writes a minimal valid empty.ipynb, opens it, and returns the initial content revision.@kilocode/sdk; added a changeset.Why
The VS Code notebook API has no way to create a notebook file at a path —
openNotebookDocument(type, data)only creates an unsaved untitled notebook with no on-disk path, which is why the original fresh-notebook flow failed. The bridge instead writes a minimal valid empty.ipynbto disk and opens it, so subsequent path-basednotebook_edit/notebook_executecalls work.Notes
notebook_editpermission and theexperimental.native_notebook_toolsexperiment — no new permission, no cloud schema change..ipynbonly for this iteration; the parent directory must already exist (nomkdir -p); existing files are never overwritten.Testing
packages/opencode: typecheck + notebook tool/service tests (new create case).packages/kilo-vscode: typecheck + lint + 30 notebook unit tests (5 new create cases: success, already-exists, missing-parent, non-.ipynb, access-denied).The full VS Code-host test suite was not run locally (
.vscode-testIPC socket path is too long inside the worktree); CI will exercise it.