Skip to content

bug: copilot requests can take a lot of requests for a single message #2858

@Lutetium-Vanadium

Description

@Lutetium-Vanadium

Describe the bug

Copilot bills usage per request, but when doing something as simple as changing a list to filter out some nodes it bills many requests even though using it with VSCode does not.

To reproduce

No response

Expected behavior

It should take one request for this single user message.

Installation method

Use lazy.nvim:

    {
        "yetone/avante.nvim",
        event = "VeryLazy",
        enabled = function() return not utils.is_git_file() end,
        build = "env -u CARGO_TARGET_DIR make",
        dependencies = {
            "nvim-lua/plenary.nvim",
            "MunifTanjim/nui.nvim",
            {
                "Lutetium-Vanadium/render-markdown.nvim",
                opts = {
                    file_types = { 'markdown', "md", "Avante" },
                    code = {
                        -- Make sure lsp extmarks are higher
                        priority = 100
                    }
                }
            },
            "HakonHarnes/img-clip.nvim",
            "folke/snacks.nvim",
        },
        opts = {
            provider = "copilot",
            mode = "agentic",
            behaviour = {
                auto_apply_diff_after_generation = false,
                support_paste_from_clipboard = true,
                auto_add_current_file = true,
                auto_approve_tool_permissions = {
                    "rag_search", "git_diff", "glob", "search_keyword", "read_file_toplevel_symbols", "read_file",
                    "create_file", "copy_path", "create_dir", "replace_in_file",

                    -- Extracted from http request sent to Copilot
                    "dispatch_agent", "ls", "grep", "delete_tool_use_message", "read_todos", "write_todos",
                    "str_replace", "view", "write_to_file", "insert", "undo_edit", "think", "get_diagnostics",
                    "attempt_completion", "web_search", "fetch", "read_definitions", "add_file_to_context",
                    "remove_file_from_context",
                },
            },
            prompt_logger = {
                enabled = true,
                log_dir = vim.fn.stdpath("cache") .. "/avante_prompts",
                fortune_cookie_on_success = false,
                next_prompt = {
                    normal = "<C-n>",
                    insert = "<C-n>",
                },
                prev_prompt = {
                    normal = "<C-p>",
                    insert = "<C-p>",
                },
            },
            mappings = { <...snipped...> },
            windows = {
                width = 40,
            },
            providers = {
                copilot = {
                    model = "claude-sonnet-4.5"
                },
            }
        }

Environment

NVIM v0.11.5
Build type: Release
LuaJIT 2.1.1763318511
Run "nvim -V1 -v" for more info

Darwin Mac 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:51 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8112 arm64 arm Darwin

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
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions