Skip to content

Conversation

@melissa-barca
Copy link
Contributor

Addresses #10344 and #10346

Adds two new commands:

  • Positron Assistant: Collect Diagnostics
  • Positron Assistant: Reset State

The Reset State command brings up a modal with some details of what is being reset and giving the option to generate a diagnostics report prior to clearing the state. If generated, the diagnostics report is saved to the user's data directory and and is open when the window reloads.

image

Resetting the state performs the following tasks:

  • Optionally saves the diagnostics report
  • Signs out of providers
  • Deletes all global state keys that start with positron.assistant
  • Deletes any API Keys associated with models
  • Clears chat history with the following commands:
  • workbench.action.chat.clearHistory
  • workbench.action.chat.clearInputHistory
  • Reloads the window

Progress is provided via notifications about the state reset.

The diagnostics report is a markdown file generated in an editor window. It includes the following:

  • A privacy notice informing the user what information is included in the report and instruction to review before sharing
  • Version information for Positron Assistant and Copilot extensions, Positron, Code OSS
  • Positron Assistant settings set to non-default values
  • Providers that the user has signed into
  • Available Models (including whether an API key is configured, but not including the key)
  • Information about the active chat session
  • The last 500 Positron Assistant logs (available from "Positron Assistant" in the output pane)

To retrieve the Positron Assistant logs I created a wrapper class around LogOutputChannel that uses a circular buffer to track the most recent log entries. We could modify the copilot extension to use this class as well if we think including those logs on the report is beneficial.

Release Notes

New Features

  • Assistant: add command "Positron Assistant: Reset State" to reset assistant state Assistant: Add command to reset state #10346
  • Assistant: add command "Positron Assistant: Collect Diagnostics" to generate diagnostics report

Bug Fixes

  • N/A

QA Notes

The only assistant state remaining after a reset should be the configured user settings.
@:assistant

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

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

readme  valid tags

@sharon-wang sharon-wang requested a review from timtmok November 18, 2025 15:13
Copy link
Member

@sharon-wang sharon-wang left a comment

Choose a reason for hiding this comment

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

This is looking great -- some initial thoughts on the diagnostics file. I'll test out the state clearing functionality separately (or @timtmok might get to it before me 🙂 )

Comment on lines +92 to +100
// Report if an API key is configured
try {
const apiKey = await context.secrets.get(`apiKey-${model.id}`);
if (apiKey) {
fields.push(` - API Key: Yes`);
}
} catch (error) {
log.trace(`Failed to check API key for model ${model.id}: ${formatError(error)}`);
}
Copy link
Member

Choose a reason for hiding this comment

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

not necessarily for this PR -- should we note if the api key is specified via env var, like ANTHROPIC_API_KEY?


const sections = Object.entries(byVendor).map(([vendor, vendorModels]) => {
const modelList = vendorModels
.map(m => ` - ${m.name} (${m.id}) - Max Input: ${m.maxInputTokens ?? 'unknown'}`)
Copy link
Member

Choose a reason for hiding this comment

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

Should we add max output tokens here too?

}

private addToBuffer(level: LogEntry['level'], message: string): void {
this.buffer.push({
Copy link
Member

Choose a reason for hiding this comment

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

awesome that we can get the log messages regardless of the user's log level! This is super helpful since the default log level doesn't give us much


async function getChatExportInfo(): Promise<string> {
try {
const chatExport = await positron.ai.getChatExport();
Copy link
Contributor

Choose a reason for hiding this comment

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

This could probably be done in a followup change to include all the chat locations. This gets the last focused and we might want to export all the current chat sessions.

My initial export after creating an inline chat included the panel chat instead since I accidentally focused the chat view.

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.

4 participants