continuedev / continuedev/continue

The bug in the edit_existing_file tool - the tool itself is writing only 30-50 lines when it should be writing 600+

Open
#13,137 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
36k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Before submitting your bug report
Relevant environment info
- OS:Win11
- Continue version: Continue/2.0.0
- IDE version: Visual Studio Code/1.133.0
- Model: qwen/qwen3.8-27b via LM Studio (local)
- config:
  # ============================================================
# IoT Firmware Expert Config — local-only
#   • Continue  → LM Studio (localhost)   [this file]
#   • Cloud LLM → GitHub Copilot (rarely) [lives in the editor,
#                 NOT in this file]
# Rule: `model:` must exactly match LM Studio's /v1/models ID.
# ============================================================
name: IoT Firmware Expert Config
version: 1.1.0
schema: v1

models:
  # Primary chat / edit model — the exact ID from `curl http://ai-host:1234/v1/models`
  - name: Qwen 3.8 27B
    provider: lmstudio
    model: qwen/qwen3.8-27b          # exact ID from /v1/models
    apiBase: http://ai-host:1234/v1
    apiKey: lm-studio                # LM Studio doesn't check this; Continue requires non-empty
    roles:
      - chat
      - edit
      - apply
    systemPrompt: |
      You are an elite IoT/embedded firmware developer with deep expertise in:
      - ESP32/STM32 microcontroller development
      - PlatformIO build system and configuration
      - Bare-metal C/C++ firmware architecture
      - RTOS, hardware peripherals, and low-level protocols (I2C, SPI, UART)
      - Python embedded scripting for IoT
      - Memory optimization and performance tuning

      Guidelines:
      - Generate production-ready, optimized code
      - Always consider memory constraints and power efficiency
      - Provide minimal, focused explanations (preserve context)
      - Use pragmatic solutions over theoretical approaches
      - Include error handling and resource cleanup
    contextLength: 75776             # keep in sync with LM Studio's context setting
    requestOptions:
      temperature: 0.3
      top_p: 0.9
      top_k: 40
      max_tokens: 4096              # raised from 2048 so whole-file code gen isn't cut off

  # Embeddings (code search / codebase indexing)
  # NOTE: NOT in the current /v1/models list. Download `nomic-embed-text-v1.5`
  # in LM Studio, then uncomment this block (and verify the ID with /v1/models).
  # - name: Nomic Embed v1.5
  #   provider: lmstudio
  #   model: nomic-embed-text-v1.5
  #
Description

The evidence from editOutcome.jsonl shows the tool itself is writing only 30-50 lines when it should be writing 600+ — that's happening at the Continue extension level, before it ever touches the VS Code editor.

The editOutcome.jsonl log confirms the bug pattern clearly:

File Previous Lines New Lines Change
state.cpp 658 34 -624
state.cpp 34 5 -29
state.cpp 5 13 +8
ui_server.cpp 690 54 -636
config.h 37 7 -30
The edit_existing_file tool is catastrophically truncating — it's keeping only the first ~30-50 lines and discarding the rest. This is a bug in the Continue agent's edit tool implementation.

Summary of findings:
Continue version: 2.0.0 (from userAgent: "Visual Studio Code/1.133.0 (Continue/2.0.0)")
Model: qwen/qwen3.8-27b via LM Studio (local)

The bug is in the edit_existing_file tool — it's not a model issue, it's a tool implementation issue. The model is correctly generating the full file content, but the tool is only writing the first chunk.
No Continue settings can fix this — the config files (config.yaml, config.ts, .continuerc.json) only control model selection, indexing, and API keys. There's no tool behavior configuration.

Reporting this bug
editOutcome.jsonl.txt
with the editOutcome.jsonl data (renamed to *.txt file for upload) as evidence. The key detail: previousCodeLines: 658, newCodeLines: 34 — the tool is dropping 95% of the file content.

To reproduce

No response

Log output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Continue extension's edit_existing_file tool implementation and compare its output with the attached editOutcome.jsonl evidence, especially the previousCodeLines and newCodeLines values. Establish a reproducible case for a 600+ line file, then verify that the completed edit preserves the expected full line count rather than truncating to 30–50 lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.