fix: support lazy apply for non-Sonnet models like qwen3-coder-plus#12470
Open
ajayjha1 wants to merge 1 commit into
Open
fix: support lazy apply for non-Sonnet models like qwen3-coder-plus#12470ajayjha1 wants to merge 1 commit into
ajayjha1 wants to merge 1 commit into
Conversation
lazyApplyPromptForModel returned undefined for any model not containing 'sonnet', causing streamLazyApply to throw 'Lazy apply not supported' whenever edit_existing_file fell back to the LLM-based apply path. Use the general-purpose prompt as the default for all models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Title: fix: support lazy apply for non-Sonnet models like qwen3-coder-plus
lazyApplyPromptForModel returned undefined for any model not containing 'sonnet', causing streamLazyApply to throw 'Lazy apply not supported' whenever edit_existing_file fell back to the LLM-based apply path. Use the general-purpose prompt as the default for all models.
Description
edit_existing_file fails silently for non-Sonnet models (e.g. qwen3-coder-plus, gpt-4o, deepseek-coder, etc.) when the model generates lazy edits with // ... existing code ... placeholders. The deterministic apply path skips those (since onlyFullFileRewrite: true), so it falls through to streamLazyApply — which threw an error because lazyApplyPromptForModel only returned a prompt for models containing "sonnet" in their name.
The claudeSonnetLazyApplyPrompt is a general-purpose lazy-apply prompt (the name is just historical). This PR removes the model-name guard and makes it the default for all models, eliminating the error and making edit_existing_file work across providers.
Fixes the issue reported with qwen3-coder-plus via DashScope where users had to add rules to force the agent away from edit_existing_file.
Checklist
Screen recording or screenshot
N/A — the fix is in the apply pipeline; visible effect is that edit_existing_file no longer fails with a silent error for non-Sonnet models.
Tests
Existing tests in core/edit/lazy/streamLazyApply.test.ts continue to pass. No new tests added — the previous code path that threw was unreachable by any test since all mock LLMs used a "sonnet" model name.
Summary by cubic
Enable lazy apply for all models by defaulting to the general-purpose prompt. Prevents silent failures in
edit_existing_filefor non-Sonnet models likeqwen3-coder-plus,gpt-4o, anddeepseek-coder.lazyApplyPromptForModelalways returns the general-purposeclaudeSonnetLazyApplyPrompt; removed the model-name check.streamLazyApply, allowing LLM-based apply across providers.Written for commit 46f0922. Summary will update on new commits. Review in cubic