Skip to content

Fix Learning notebook autosave - #3683

Merged
Dhairya Patel (HABER7789) merged 4 commits into
mainfrom
HABER7789/notebook-autosave
Sep 10, 2026
Merged

Fix Learning notebook autosave#3683
Dhairya Patel (HABER7789) merged 4 commits into
mainfrom
HABER7789/notebook-autosave

Conversation

@HABER7789

Copy link
Copy Markdown
Contributor

Learning notebooks are now saved after metadata changes and before moving to another unit, preventing unwanted save prompts and preserving learner edits.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

saveCourseWorkbook can report success even when the notebook remains dirty after saving, which can lead to stale-tab closure still prompting to save (or risking loss of edits).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the VS Code Learning experience for *.workbook.ipynb notebooks by ensuring learner workbooks are auto-saved when Jupyter updates notebook metadata and by attempting to save workbooks before closing stale learning tabs, reducing unwanted “unsaved changes” prompts.

Changes:

  • Added LearningService.isCourseWorkbook and LearningService.saveCourseWorkbook (with per-notebook save queueing) to centralize workbook detection and serialized auto-save.
  • Updated learning notebook sync + notebook change handling to call saveCourseWorkbook after sync and on metadata/execution changes.
  • Updated stale-tab closing to save workbooks first and skip closing ones that could not be saved; adjusted notebook opening flow to explicitly show the notebook after the Jupyter API opens it.
File summaries
File Description
source/vscode/src/learning/service.ts Adds workbook detection and queued saving; ensures stale learning tabs are saved (and skips closing when save fails).
source/vscode/src/learning/notebookSync.ts Saves a course workbook after syncing when restoring sessions and uses service.isCourseWorkbook for context.
source/vscode/src/learning/index.ts Auto-saves workbooks on notebook metadata changes (and execution changes) via saveCourseWorkbook.
source/vscode/src/learning/commands.ts After opening via Jupyter’s API, explicitly shows the notebook document to ensure it is visible/active.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/vscode/src/learning/service.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

All reviewed changes are acceptable with no unresolved issues.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Comment thread source/vscode/src/learning/commands.ts Outdated
Comment thread source/vscode/src/learning/notebookSync.ts
Comment thread source/vscode/src/learning/notebookSync.ts
Comment thread source/vscode/src/learning/service.ts Outdated
Comment thread source/vscode/src/learning/service.ts
Comment thread source/vscode/src/learning/service.ts Outdated
Comment thread source/vscode/src/learning/service.ts
Comment thread source/vscode/src/learning/service.ts Outdated
Comment thread source/vscode/src/learning/index.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Metadata-only changes can still occur after synchronization without triggering a save.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread source/vscode/src/learning/index.ts Outdated
Comment thread source/vscode/src/learning/notebookSync.ts
@HABER7789
Dhairya Patel (HABER7789) added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 35121e7 Sep 10, 2026
14 checks passed
@HABER7789
Dhairya Patel (HABER7789) deleted the HABER7789/notebook-autosave branch September 10, 2026 23:24
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.

3 participants