Skip to content

Devstral models rewrite all prefix code (probably a prompt issue) #9424

@adoyxx

Description

@adoyxx

Before submitting your bug report

Relevant environment info

- OS: Linux Mint 22.2
- Continue version: 1.2.11
- IDE version: VS Codium 1.106
- Model: devstral-small-latest AND devstral-medium-latest
- config:
  
name: Local Agent
version: 1.0.0
schema: v1
models:
  - name: Codestral
    provider: mistral
    model: codestral-latest
    apiKey: API_KEY
    roles:
      - autocomplete
      - edit
      - chat
  - name: Devstral
    provider: mistral
    model: devstral-medium-latest
    apiKey: API_KEY
    roles:
      - edit
      - chat
  - name: Devstral Small
    provider: mistral
    model: devstral-small-latest
    apiKey: API_KEY
    roles:
      - edit
      - chat

Description

Issue

When editing code in Devstral and Devstral Small, the model rewrites not only the selected section but also the surrounding code. It should only modify the highlighted part while keeping the rest intact.

Workaround

I changed the prompt for these models to this:

Consider the following code:
Context before the editable section:
\`\`\`{{{language}}}
{{{prefix}}}
\`\`\`
Editable section (modify only this part):
\`\`\`{{{language}}}
{{{codeToEdit}}}
\`\`\`
Context after the editable section:
\`\`\`{{{language}}}
{{{suffix}}}
\`\`\`

Edit the code above to perfectly satisfy the following user request:
{{{userInput}}}

Output ONLY the modified editable section.
Do not rewrite the context before or after.
Leave existing comments in place unless changes require modifying them.
Do not include explanations, tags, or extra markdown.

It helped 😃

To reproduce

  1. Highlite some lines of code and go to edit mode (Ctrl + I)
Image
  1. Choose Devstral model, type some prompt and send it
Image
  1. Result:
Image

Log output

Metadata

Metadata

Labels

area:editRelates to side panel Edit featureide:vscodeRelates specifically to VS Code extensionkind:bugIndicates an unexpected problem or unintended behavioros:linuxHappening specifically on Linux

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions