Skip to content

Conversation

@nstrayer
Copy link
Contributor

@nstrayer nstrayer commented Dec 2, 2025

Addresses #10856, #10858, #10853, #10851, and #10859.

Summary

This PR includes several improvements to the Positron Notebooks Assistant based on user feedback:

  1. Fixes AI suggestions error (Positron Notebooks: Error using "Generate AI suggestions" action #10856): Optimized notebook mode caching to fix the error preventing AI suggestions from appearing in the quickpick
  2. Auto-runs code cells (Positron Notebooks: Single tool call to add and run cell(s) #10853): Code cells added by the Assistant now execute automatically, eliminating the 3-5 second delay from requiring two separate tool calls
  3. Auto-renders markdown cells (Positron Notebooks: Render markdown cells added by Assistant #10858): Markdown cells added by the Assistant now render automatically instead of staying in edit mode
  4. Reduces token usage (Positron Notebooks: Assistant execute cells tool output contains token-expensive base64 data #10851): Improved MIME type detection to avoid sending token-expensive base64 data in tool outputs
  5. Performance improvements (Positron Notebooks: Assistant sometimes stays "Working..." for >1 min #10859): Caching optimizations significantly reduce response latency and help prevent the Assistant getting stuck "Working..." for extended periods

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

@:positron-notebooks @:assistant

@nstrayer nstrayer self-assigned this Dec 2, 2025
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:positron-notebooks @:assistant

readme  valid tags

@nstrayer nstrayer force-pushed the positron-nb-assistant-feedback-fixes branch from 161bd92 to 991ad68 Compare December 2, 2025 19:42
@nstrayer nstrayer marked this pull request as ready for review December 2, 2025 19:50
Copilot finished reviewing on behalf of nstrayer December 2, 2025 19:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements several improvements to the Positron Notebooks Assistant based on user feedback, focusing on performance optimizations through better caching, auto-execution of code cells, auto-rendering of markdown cells, and improved MIME type handling to reduce token usage.

Key Changes

  • Performance & Caching: Notebook context is now injected as a separate user message with its own cache breakpoint instead of being embedded in the system prompt, maximizing cache hits when notebook state changes
  • Auto-execution: Code cells added by the Assistant now execute automatically by default (configurable via run parameter), eliminating the need for separate tool calls and reducing response latency
  • Auto-rendering: Markdown cells with content now automatically render instead of entering edit mode, providing immediate visual feedback

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
notebookMimeUtils.ts New utility module for identifying image vs text-based MIME types to optimize token usage
PositronNotebookInstance.ts Modified to prevent auto-entering edit mode for markdown cells with content, enabling auto-rendering
mainThreadNotebookFeatures.ts Enhanced MIME type handling in cell outputs using the new utility functions with fallback logging for unknown types
notebookUtils.ts Added serializeNotebookContextAsUserMessage() to format notebook state as a separate user message for caching
notebookTools.ts Enhanced EditNotebookCells tool to auto-execute code cells after adding them, with run parameter to opt-out
promptRender.ts Removed notebook context from template augmentation since it's now injected separately as a user message
participants.ts Refactored to inject notebook context as a dedicated user message after general context for better cache optimization
notebook-mode-*.md Updated prompt templates to reference notebook context in separate message rather than embedding it inline
positron-assistant-notebook-mode.md Updated documentation to reflect auto-execution behavior
package.json Updated tool description to document the run parameter and auto-execution default behavior

@nstrayer nstrayer force-pushed the positron-nb-assistant-feedback-fixes branch from 231c837 to 2c67555 Compare December 3, 2025 15:07
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.

2 participants