Skip to content

fix: support lazy apply for non-Sonnet models like qwen3-coder-plus#12470

Open
ajayjha1 wants to merge 1 commit into
continuedev:mainfrom
ajayjha1:fix/lazy-apply-non-sonnet-models
Open

fix: support lazy apply for non-Sonnet models like qwen3-coder-plus#12470
ajayjha1 wants to merge 1 commit into
continuedev:mainfrom
ajayjha1:fix/lazy-apply-non-sonnet-models

Conversation

@ajayjha1
Copy link
Copy Markdown

@ajayjha1 ajayjha1 commented May 22, 2026

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_file for non-Sonnet models like qwen3-coder-plus, gpt-4o, and deepseek-coder.

  • Bug Fixes
    • lazyApplyPromptForModel always returns the general-purpose claudeSonnetLazyApplyPrompt; removed the model-name check.
    • Removed the "Lazy apply not supported" error path in streamLazyApply, allowing LLM-based apply across providers.

Written for commit 46f0922. Summary will update on new commits. Review in cubic

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.
@ajayjha1 ajayjha1 requested a review from a team as a code owner May 22, 2026 09:15
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 22, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant