positron icon indicating copy to clipboard operation
positron copied to clipboard

Assistant: enhance `/exportQuarto` prompt to dissuade from specifying editor mode

Open sharon-wang opened this issue 4 months ago • 2 comments

System details:

Positron and OS details:

Posit Workbench 2025.08.0+343.pro2, “Cucumberleaf Sunflower” (830f5d6b) Positron: 2025.08.0 build 130 Quarto extension 1.123.0

Session details:

Anthropic Claude 4 Sonnet, but possibly any model

Describe the issue:

Sometimes, when using /exportQuarto in Positron Assistant "Ask" mode, the model will generate a quarto document with editor: visual in the YAML frontmatter of the document.

Image

Then, when a user clicks the "Preview" button in the Editor Actions bar, this results in the following modal showing:

Image
  • relevant Quarto code https://github.com/quarto-dev/quarto/blob/3fe790b2d85e86694a71fdad172f785f2ee90531/apps/vscode/src/providers/editor/editor.ts#L363-L387

Clicking on Cancel only dismisses the modal for a few milliseconds, then the modal comes back. So, the user must select Use Visual Mode

Steps to reproduce the issue:

  1. Create a quarto document that has editor: visual in the YAML frontmatter of the document
  2. Save the file
  3. Click the "Preview" button in the Editor Actions bar
  4. See the modal as described above

I could not reproduce this in Positron Desktop on Mac:

Positron Version: 2025.10.0 build 14 Code - OSS Version: 1.103.0 Commit: c3ee3a3a9d01ff2046879b5481b9b4ee5baa9dec

  • I think this is because I must have accepted the modal at some point. I would suspect this is reproducible with a clean Positron state.

Expected or desired behavior:

Shouldn't get into the Cancel loop.

Were there any error messages in the UI, Output panel, or Developer Tools console?

N/A

Proposed Solution

Modify the quarto prompt to dissuade models from specifying the editor in the YAML frontmatter, unless the user explicitly requests a particular mode.

Related Quarto issue: https://github.com/quarto-dev/quarto/issues/805

sharon-wang avatar Sep 02 '25 20:09 sharon-wang

Could we prompt the tool to use really specific front matter YAML? Or even specify the front matter in a more templated way (no generation)?

juliasilge avatar Sep 03 '25 20:09 juliasilge

I did a quick exploration into modify the quarto prompt to:

The user has invoked you to create a complete Quarto document based on the full conversation so far. Follow these instructions to produce the document:
- Output ONLY the contents of the `.Qmd` file. Do not wrap the output in markdown tags. Do not output the file as a codeblock.
- Expand on details in the text of the report. Include plots and tables where relevant. ONLY include information, details, plots, and tables that are present in the conversation. Do NOT invent or fabricate any content.
- The Quarto document frontmatter must contain ONLY the `title` field. Add other fields to the frontmatter ONLY if the user specifically requests them.

In testing, this always returned a Quarto doc with just the title field in the frontmatter, which helps avoid the Visual Editor issue, but this would ultimately be a workaround for https://github.com/quarto-dev/quarto/issues/805.

Exploring this revealed some other issues:

  • Generating a .qmd file with Python code blocks requires that the user has jupyter installed in their Python environment in order to preview the doc. The Terminal output indicates this error, but it is an unexpected step
  • The generated .qmd file often contains code cells that cannot run due to missing variables (i.e. variables that were defined in separate scripts that were run, but the contents of which are not necessarily part of the chat conversation, or not used by the model to generate the .qmd file). As a result, the document is not previewable because the code cell execution errors during rendering

sharon-wang avatar Sep 09 '25 16:09 sharon-wang