avante.nvim icon indicating copy to clipboard operation
avante.nvim copied to clipboard

bug: cursor apply hangs if the file being modified is longer than the model max output tokens

Open colatkinson opened this issue 8 months ago • 0 comments

Describe the bug

When editing longer files and using Cursor apply mode, it begins to work and scrolls through the file, even generating diffs. However, it abruptly stops and spins indefinitely.

Unsure of any additional debugging steps or logs that could be useful -- if there are any, please let me know.

To reproduce

I've been able to reproduce using a number of code files, but for the purposes of a simple repro I've been using the plaintext Apache 2.0 and GPL 3.0 licenses.

I've tested with several Gemini models (gemini-2.5-pro-exp-03-25, gemini-2.0-flash, and gemini-2.0-flash-lite). Unsure if this is specific to these or if this is a more general problem.

  1. Open the file and enter "ask" mode.
  2. Prompt: "Append to the file an explanation of the history of the FSF and the open source movement."
  3. In the case of the Apache license, it will make the modifications and allow applying hunks to the file. In the case of the GPL license, it will scroll through the file before eventually stopping. The "Applying changes" spinner continues to spin indefinitely.

Apache-2.0.txt GPL-3.0-only.txt

Expected behavior

No response

Installation method

call dein#add('stevearc/dressing.nvim')
call dein#add('MunifTanjim/nui.nvim')
call dein#add('HakonHarnes/img-clip.nvim')
call dein#add('MeanderingProgrammer/render-markdown.nvim', #{ ft: ['markdown', 'Avante'] })
call dein#add('yetone/avante.nvim', #{ build: 'make', rev: '89a86f0fc197ec9ffb3663a499432f8df4e4b1e5' })
require('avante_lib').load()
require('avante').setup ({
  provider = "gemini-pro",
  cursor_applying_provider = "gemini-pro",
  behaviour = {
    minimize_diff = true,
    enable_cursor_planning_mode = true,
  },
  gemini = {
    model = "gemini-2.0-flash",
  },
  vendors = {
    ["gemini-pro"] = {
      __inherited_from = "gemini",
      model = "gemini-2.5-pro-exp-03-25",
      timeout = 120000,
    },
    ["gemini-flash"] = {
      __inherited_from = "gemini",
      model = "gemini-2.0-flash-lite",
      timeout = 120000,
    },
  },
  windows = {
    sidebar_header = {
      enabled = true,
      rounded = false,
    },
  },
})

Environment

NVIM v0.11.0 Build type: RelWithDebInfo LuaJIT 2.1.1741730670 Run "nvim -V1 -v" for more info

Linux tenax 6.13.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 23 Mar 2025 17:17:30 +0000 x86_64 GNU/Linux

colatkinson avatar Apr 03 '25 07:04 colatkinson