fix: strengthen default Apply prompt for local models #10486
+25
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
defaultApplyPromptreturns a single-sentence plain string with no code-only constraintdefaultApplyPromptto returnChatMessage[]with labeled ORIGINAL CODE / SUGGESTED EDIT sections, explicit "Output ONLY code" instructions, and an assistant prefill opening a code blockstreamChat(instead ofstreamComplete), and the assistant prefill forces the model to continue with code rather than prosefilterCodeBlockLinesfilter strips the closing fence from the outputContext
defaultApplyPromptis the fallback Apply prompt used when no model-specificpromptTemplates.applyis configured. It applies when a model callsedit_existing_fileand the Apply step merges the suggested code into the original file.The previous prompt was:
Local models (tested with gpt-oss-20b via LM Studio) interpreted this as a request to describe changes rather than output code. The new prompt with explicit rules and assistant prefill produces clean code diffs.
What this doesn't change
core/edit/lazy/)gptEditPrompt, notdefaultApplyPrompt)promptTemplates.applyin config (custom overridesdefaultApplyPrompt)Test plan
cd core && npm run vitest— 1654 tests pass, 0 failuresdefaultApplyPrompt)🤖 Generated with Claude Code
Summary by cubic
Make the default Apply prompt produce code (not prose) for local/open‑weight models by switching to a chat-based prompt with code-only instructions and an assistant prefill. Apply now routes through streamChat and returns the full modified file.
Written for commit 25026d7. Summary will update on new commits.