Skip to content

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

Description

@olegperepelkin-maker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions