Skip to content

[Bug]: Tool approval messages seem to shift the chat buffer header #3093

@olimorris

Description

@olimorris

Pre-submission checklist

  • I have read the documentation
  • I have updated the plugin and all dependencies to the latest versions
  • I have searched for existing issues and discussions
  • My issue is not a minor or cosmetic quirk (e.g., formatting, spacing, or other non-functional details)

Neovim version (nvim -v)

NVIM v0.13.0-dev-369+g0697c24601

Operating system/version

macOS

Adapter and model

Copilot and Haiku

Describe the bug

When I ask Copilot to grep search the CodeCompanion repo for for chat, it does so but in the process, the LLM's H2 header seems to shift

Steps to reproduce

  1. Open Neovim and do :CodeCompanionChat
  2. Ensure the Copilot adapter is loaded
  3. Send a single prompt "Are you working?". Wait for the LLM to respond
  4. Then send "Can you use @{grep_search} to search the docs for "chat"?"

Expected behavior

The LLM header to remain in place

Screenshots or recordings (optional)

Image

minimal.lua file

---@diagnostic disable: missing-fields

--[[
NOTE: Set the config path to enable the copilot adapter to work.
It will search the following paths for a token:
  - "$CODECOMPANION_TOKEN_PATH/github-copilot/hosts.json"
  - "$CODECOMPANION_TOKEN_PATH/github-copilot/apps.json"
--]]
vim.env["CODECOMPANION_TOKEN_PATH"] = vim.fn.expand("~/.config")

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

-- Your CodeCompanion setup
local plugins = {
  {
    "olimorris/codecompanion.nvim",
    -- Test with local version (delete if not required)
    -- dir = "~/Code/Neovim/codecompanion.nvim",
    dependencies = {
      { "nvim-lua/plenary.nvim" },
      {
        "nvim-treesitter/nvim-treesitter",
        lazy = false,
        build = ":TSUpdate",
      },

      -- Test with blink.cmp
      {
        "saghen/blink.cmp",
        version = "1.*",
        opts = {
          keymap = {
            preset = "enter",
            ["<S-Tab>"] = { "select_prev", "fallback" },
            ["<Tab>"] = { "select_next", "fallback" },
          },
          cmdline = { sources = { "cmdline" } },
          sources = {
            default = { "lsp", "path", "buffer", "codecompanion" },
          },
        },
      },
    },
    opts = {
      --Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
      interactions = {
        chat = { adapter = "copilot" },
        inline = { adapter = "copilot" },
      },
      opts = {
        log_level = "DEBUG",
      },
    },
  },
}

require("lazy.minit").repro({ spec = plugins })

-- CONFIGURE PLUGINS HERE -----------------------------------------------------

-- Setup Tree-sitter
-- NOTE: Please restart Neovim to ensure parsers are loaded correctly
require("nvim-treesitter")
  .install({
    "lua",
    "markdown",
    "markdown_inline",
    "yaml",
  }, { summary = true, max_jobs = 10 })
  :wait(1800000)

Log output (optional)

No response

Minimal reproduction confirmation

  • Yes, I have tested and provided a minimal.lua file that reproduces the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreviewed-by-AIThe CodeCompanion agent reviewed this PR

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions