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

bug: After updating avante.nvim to the latest version, message replies ending without finishing.

Open zhouatie opened this issue 7 months ago • 24 comments

Describe the bug

Hello,

After updating avante.nvim to the latest version, message replies ending without finishing.

Image

Interestingly, when I switched to the following commit:

commit = f9aa75459d403d9e963ef2647c9791e0dfc9e5f9

Everything works perfectly without any issues.

Here is my configuration:

return {
  {
    "yetone/avante.nvim",
    event = "VeryLazy",
    commit = "f9aa75459d403d9e963ef2647c9791e0dfc9e5f9",
    opts = {
      provider = "copilot",

      copilot = {
        model = "claude-3.7-sonnet",
        endpoint = "https://api.githubcopilot.com",
        allow_insecure = false,
        timeout = 10 * 60 * 1000,
        temperature = 0,
        max_completion_tokens = 80000,
        max_tokens = 80000,
        reasoning_effort = "high",
      },

      behaviour = {
        enable_cursor_planning_mode = true,
        enable_claude_text_editor_tool_mode = true,
        enable_token_counting = false,
      },

      windows = {
        width = 40,
        input = {
          prefix = "",
          height = 12,
        },
      },
    },
    build = "make",
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "stevearc/dressing.nvim",
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      "echasnovski/mini.pick",
      "nvim-telescope/telescope.nvim",
      "hrsh7th/nvim-cmp",
      "ibhagwan/fzf-lua",
      "nvim-tree/nvim-web-devicons",
      "zbirenbaum/copilot.lua",
      {
        "MeanderingProgrammer/render-markdown.nvim",
        opts = {
          file_types = { "markdown", "Avante" },
        },
        ft = { "markdown", "Avante" },
      },
    },
  },
}

Could you please help investigate this issue? Let me know if you need any additional details. Thank you for your assistance!

To reproduce

No response

Expected behavior

No response

Installation method

Use lazy.nvim:

{
  "yetone/avante.nvim",
  event = "VeryLazy",
  lazy = false,
  version = false, -- set this if you want to always pull the latest change
  opts = {
    -- add any opts here
  },
  -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
  build = "make",
  -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "stevearc/dressing.nvim",
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

neovim version

Environment

NVIM v0.11.0 Build type: Release LuaJIT 2.1.1744318430

Darwin HIH-L-10836.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000 arm64

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here
  },
})

zhouatie avatar May 03 '25 14:05 zhouatie

I'm seeing the same.

Image

mhuggins7278 avatar May 05 '25 17:05 mhuggins7278

After some more digging this only seems to be an issue with the copilot provider for me. If change to either openai or claude the tools seem to behave better

mhuggins7278 avatar May 05 '25 19:05 mhuggins7278

for me even this commit commit = f9aa75459d403d9e963ef2647c9791e0dfc9e5f9 isn't working, it stops midway. Using copilot/claude-3.7-sonnet

ananya-mallik-ps avatar May 06 '25 20:05 ananya-mallik-ps

commit = b2064a8f40cbd10ddd3ea9d82f0bdb2bcaf2f152

the same.

Image

zhouatie avatar May 08 '25 02:05 zhouatie

having the same issue with copilot/claude-3.7-sonnet

iammmiru avatar May 08 '25 15:05 iammmiru

same issue here with openrouter anthropic/claude-3.7-sonnet

joaoinez avatar May 08 '25 22:05 joaoinez

same issue with copilot/claude-3.7-sonnet

newObjectccc avatar May 09 '25 15:05 newObjectccc

Same issue here with the vertex provider using gemini-2.5-pro-preview

trevorprater avatar May 12 '25 19:05 trevorprater

I've spent something like ten hours trying to fix this issue, but no luck. I'm now seeing it in both Vertex and Gemini providers. Has anyone found a workaround?

trevorprater avatar May 13 '25 01:05 trevorprater

That's become the case with all models I use, all suppliers for almost a week now.

addadi avatar May 13 '25 14:05 addadi

I've been dealing with this issue for about two weeks now too. It takes repeating the prompt multiple to work - and sometimes never works.

zachbharris avatar May 14 '25 18:05 zachbharris

Yeah, it's a large enough issue for me to stop using Neovim as my primary IDE and switch to RooCode until it's fixed, unfortunately. As mentioned in my past comment, I've already devoted over ten hours trying to find a fix, but have failed thus far, so I at least tried to fix it before reality set in and work deadlines loomed, forcing me to use an inferior IDE 🥲

trevorprater avatar May 14 '25 18:05 trevorprater

I was experiencing this as well with copilot/sonnet-3.5/7 but the issue has gone away after switching to the claude provider.

jamestrew avatar May 18 '25 00:05 jamestrew

Does anyone have a minimal reproducible example? I wanted to take a swing at it but every time I try to reproduce it - it just works. For me it seems to happen on longer chats, but I couldn't distill it to something that would use minimal amount of tokens and be consistent.

kyrisu avatar May 18 '25 08:05 kyrisu

It definitely feels like a provider rate limiting thing since the model is the one not invoking a tool call. I’ve also seen the same behavior in codecompanion and the vscode copilot so I don’t necessarily think it is an avante bug.

For me the message pretty much always ends with a colon when it happens and I can’t think of another legitimate reason for a message from the llm to end with a colon. Thinking out loud here, can we consider a message that ends with a colon an “incomplete message” and just send another user message to coax the llm to continue?

I’ve been spamming “ok” to it when it pauses and it seems to continue on very reliably. There are certainly billing implications here given the coming changes to copilot usage limits so it would definitely need to be configurable.

eli0shin avatar May 19 '25 04:05 eli0shin

I've found a relatively simple query that consistently fails for me:

Create a new file called test.txt in testdir/newdir with the content "Hello World". Make sure to check if the directories exist first.

The result:

Image

From what I've found out so far it's not even trying to call the tool after the last sentence.

kyrisu avatar May 19 '25 09:05 kyrisu

same issue with copilot/claude-3.7-sonnet

sometimes i use an to create a new chat in my lazyvim, it's properly work again. new chat feature also provide by avante.

newObjectccc avatar May 23 '25 06:05 newObjectccc

I'm also getting the same issue with:

provider = 'copilot',
copilot = { model = 'claude-3.7-sonnet' },

joshmedeski avatar May 27 '25 22:05 joshmedeski

‌‌‌The latest version should have resolved this issue, you can update and test it.

yetone avatar May 28 '25 07:05 yetone

‌‌‌The latest version should have resolved this issue, you can update and test it.

Image

the same

zhouatie avatar May 29 '25 03:05 zhouatie

‌‌‌The latest version should have resolved this issue, you can update and test it.

Image the same

Which provider and model are you using?

yetone avatar May 29 '25 04:05 yetone

I'm also getting the same issue with:

provider = 'copilot', copilot = { model = 'claude-3.7-sonnet' },

The copilot's claude-3.7-sonnet cannot solve this problem because: https://github.com/yetone/avante.nvim/issues/2093#issuecomment-2917351508

yetone avatar May 29 '25 04:05 yetone

‌‌‌The latest version should have resolved this issue, you can update and test it.

Image the same

Which provider and model are you using?

copilot, claude-3.7-sonnet

I'm also getting the same issue with: provider = 'copilot', copilot = { model = 'claude-3.7-sonnet' },

The copilot's claude-3.7-sonnet cannot solve this problem because: #2093 (comment)

commit = f9aa75459d403d9e963ef2647c9791e0dfc9e5f9 Everything works perfectly without any issues.

zhouatie avatar May 29 '25 10:05 zhouatie

‌‌‌The latest version should have resolved this issue, you can update and test it.

Image the same

Which provider and model are you using?

copilot, claude-3.7-sonnet

I'm also getting the same issue with: provider = 'copilot', copilot = { model = 'claude-3.7-sonnet' },

The copilot's claude-3.7-sonnet cannot solve this problem because: #2093 (comment)

commit = f9aa75459d403d9e963ef2647c9791e0dfc9e5f9 Everything works perfectly without any issues.

The avante version of the commit you quoted actually has a big problem, that is, the agent mode is not correct, because it does not carry the historical tool calling record, resulting in the LLM missing many necessary historical information.

yetone avatar May 29 '25 19:05 yetone

I still can't get tools to work, seeing the following exception when I try:

   Error  12:20:07 msg_show.lua_error Error executing vim.schedule lua callback: ...hare/nvim/lazy/avante.nvim/lua/avante/llm_tools/init.lua:37: attempt to concatenate field 'command' (a nil value)
stack traceback:
	...hare/nvim/lazy/avante.nvim/lua/avante/llm_tools/init.lua:37: in function 'func'
	...hare/nvim/lazy/avante.nvim/lua/avante/llm_tools/init.lua:1268: in function 'process_tool_use'
	...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:690: in function 'on_stop'
	...re/nvim/lazy/avante.nvim/lua/avante/providers/openai.lua:472: in function 'parse_response'
	...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:367: in function 'parse_stream_data'
	...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:443: in function <...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:439>

aaronmcadam avatar Jun 13 '25 11:06 aaronmcadam

This issue no longer exists in the latest version.

yetone avatar Jun 15 '25 17:06 yetone