You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated the plugin to the latest version before submitting this issue
I have searched for existing issues/discussions
I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.11
Operating system/version
Arch Linux
Describe the bug
I'm trying to create a workflow that uses a custom tool. In Group 1 everything works fine — the tools load and the references appear in Context normally — but once we move to Group 2, the tools stop working. It's as if the agent knows they exist but simply can't execute them. I don't get an error or any kind of feedback.
I've tried reading the source code, but I haven't found anything helpful. I know it has something to do with using a condition in Group 2, but I haven’t found a solution.
I've tried the obvious fixes: tweaking the configuration, placing the tools elsewhere, using other tools, setting type = persistent, change adapter, etc., but nothing has worked.
I've taken the time to create a minimal init.lua that reproduces the problem — I hope this helps clarify the cause of this problem.
Steps To Reproduce
Steps to reproduce the issue:
I’ve marked the failure points with ⚠️
Create a custom tool
Create a workflow with 2 groups
Group 1 has two prompts: one system and one user. In the user prompt we simply test the tool with @test execute this
In Group 2, we add another user-type prompt that also executes the tool with @test execute again, but we add the condition: return _G.codecompanion_current_tool == "test"
(I set auto_submit=true here, but I also tried setting it to false, and it made no difference — so it seems irrelevant)
Now test the workflow via CodeCompanionActions -> workflow -> test_workflow
We notice that Group 2 loads correctly and if we submit it, @test executes properly ⚠️ But once the agent responds, Group 2 no longer loads, even though it should — we’re apparently still stuck in Group 1
Since nothing happens, we manually type @test execute this
The agent executes @test again as expected, but then something strange happens ⚠️ Now it moves to Group 2, but the tools are not loaded — even if the content is @test execute again, the tool test is not loaded ⚠️ Whether using auto_submit=true or submitting manually, the tool simply seems unavailable ⚠️ When the agent responds, it attempts to use the tool, but it doesn't get executed. We also don’t get any error or feedback — I don't know whether the tool is still technically loaded and just can't be used, or if it's not loaded at all
To further illustrate, here’s a snippet of the conversation once Group 2 is activated automatically thanks to the condition and auto_submit:
### Me### Response@test execute the test again
### CodeCompanion (Anthropic)### Reasoning
The user is asking me to execute the test again. They've
written "### Response" which might be formatting, and
then "test execute the test again". I should use the test
function to execute it.
### Response
It’s exactly as weird as it looks: .Me is empty, and instead it inserts the content into .Response. Then the agent reasons and even recognizes that I wrote something like Response, and finally the agent’s actual .Response is completely empty.
Expected Behavior
Expected behavior:
When Group 1 finishes, it should immediately proceed to Group 2 if the condition is met
Tools should be loaded at all times, or at least there should be a way to configure which tools are available for each group
init.lua file
--[[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 setuplocalplugins= {
{
"olimorris/codecompanion.nvim",
dependencies= {
{ "nvim-treesitter/nvim-treesitter", build=":TSUpdate" },
{ "nvim-lua/plenary.nvim" },
-- Test with blink.cmp (delete if not required)
{
"saghen/blink.cmp",
lazy=false,
version="*",
opts= {
keymap= {
preset="enter",
["<S-Tab>"] = { "select_prev", "fallback" },
["<Tab>"] = { "select_next", "fallback" },
},
cmdline= { sources= { "cmdline" } },
sources= {
default= { "lsp", "path", "buffer", "codecompanion" },
},
},
},
-- Test with nvim-cmp-- { "hrsh7th/nvim-cmp" },
},
opts= {
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.luaprompt_library= {
["Test Workflow"] = {
strategy="workflow",
description="test workflow",
opts= {
ignore_system_prompt=true,
short_name="test_workflow",
is_slash_cmd=true,
},
prompts= {
{
{
role="system",
content="simple execute test tool",
opts= { auto_submit=false, }
},
{
role="user",
content="@test execute this",
opts= { auto_submit=false }
}
},
{
{
role="user",
content="@test execute the test again",
condition=function()
return_G.codecompanion_current_tool=="test"end,
opts= { auto_submit=true }
}
}
}
}
},
strategies= {
--NOTE: Change the adapter as requiredchat= {
adapter="anthropic",
tools= {
test= {
description="a simple test for this bug report",
callback= {
name="test",
cmds= {
function(self, args, input)
vim.notify("¡Hola Mundo desde la herramienta de prueba!", vim.log.levels.INFO)
return { status="success", data="¡Hola Mundo!" }
end,
},
system_prompt=[[simple custom tool test]],
schema= {
type="function",
["function"] = {
name="test",
description="Muestra un mensaje '¡Hola Mundo!' en Neovim",
parameters= {
type="object",
properties= {
response= {
type="string",
description="simple response test message hello world"
}
}
},
strict=true,
additionalProperties=false,
},
},
handlers= {
setup=function(self, agent)
returnvim.notify("Configurando la herramienta de prueba", vim.log.levels.INFO)
end,
on_exit=function(self, agent)
returnvim.notify("Finalizando la herramienta de prueba", vim.log.levels.INFO)
end,
},
output= {
success=function(self, agent, cmd, stdout)
localchat=agent.chatreturnchat:add_tool_output(self, tostring(stdout[1]),
"Hello world")
end,
error=function(self, agent, cmd, stderr, stdout)
returnvim.notify("Error hello world", vim.log.levels.ERROR)
end,
},
}
}
}
},
inline= { adapter="anthropic" },
},
opts= {
log_level="DEBUG",
},
},
},
}
-- Leaving this comment in to see if the issue author notices ;-)-- This is so I can tell if they've really tested with their own repro.lua filerequire("lazy.minit").repro({ spec=plugins })
-- Setup Tree-sitterlocalts_status, treesitter=pcall(require, "nvim-treesitter.configs")
ifts_statusthentreesitter.setup({
ensure_installed= { "lua", "markdown", "markdown_inline", "yaml", "diff" },
highlight= { enable=true },
})
end-- Setup nvim-cmp-- local cmp_status, cmp = pcall(require, "cmp")-- if cmp_status then-- cmp.setup({-- mapping = cmp.mapping.preset.insert({-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),-- ["<C-f>"] = cmp.mapping.scroll_docs(4),-- ["<C-Space>"] = cmp.mapping.complete(),-- ["<C-e>"] = cmp.mapping.abort(),-- ["<CR>"] = cmp.mapping.confirm({ select = true }),-- -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.-- }),-- })-- end
Did you check the docs and existing issues?
Neovim version (nvim -v)
0.11
Operating system/version
Arch Linux
Describe the bug
I'm trying to create a workflow that uses a custom tool. In Group 1 everything works fine — the tools load and the references appear in Context normally — but once we move to Group 2, the tools stop working. It's as if the agent knows they exist but simply can't execute them. I don't get an error or any kind of feedback.
I've tried reading the source code, but I haven't found anything helpful. I know it has something to do with using a condition in Group 2, but I haven’t found a solution.
I've tried the obvious fixes: tweaking the configuration, placing the tools elsewhere, using other tools, setting type = persistent, change adapter, etc., but nothing has worked.
I've taken the time to create a minimal init.lua that reproduces the problem — I hope this helps clarify the cause of this problem.
Steps To Reproduce
Steps to reproduce the issue:⚠️
I’ve marked the failure points with
@test execute this
@test execute again
, but we add the condition:return _G.codecompanion_current_tool == "test"
(I set
auto_submit=true
here, but I also tried setting it tofalse
, and it made no difference — so it seems irrelevant)CodeCompanionActions -> workflow -> test_workflow
@test
executes properly@test execute this
@test
again as expected, but then something strange happens@test execute again
, the tooltest
is not loadedauto_submit=true
or submitting manually, the tool simply seems unavailableTo further illustrate, here’s a snippet of the conversation once Group 2 is activated automatically thanks to the condition and
auto_submit
:It’s exactly as weird as it looks:
.Me
is empty, and instead it inserts the content into.Response
. Then the agent reasons and even recognizes that I wrote something likeResponse
, and finally the agent’s actual.Response
is completely empty.Expected Behavior
Expected behavior:
init.lua file
Log output
[INFO] 2025-05-24 20:46:12
[Strategy] Workflow Initiated
[INFO] 2025-05-24 20:46:13
Chat request started
[INFO] 2025-05-24 20:46:13
Request body file: /tmp/nvim.username/f75GPa/0.json
[DEBUG] 2025-05-24 20:46:13
Request:
{ "-sSL", "-D", "/run/user/1000/plenary_curl_9c1a45b6.headers", "-X", "POST", "-H", "X-Api-Key: sk-ant-XXX", "-H", "Content-Type: application/json", "-H", "Anthropic-Version: 2023-06-01", "-H", "Anthropic-Beta: prompt-caching-2024-07-31", "-d", "@/tmp/nvim.username/f75GPa/0.json", "--retry", "3", "--retry-delay", "1", "--keepalive-time", "60", "--connect-timeout", "10", "--tcp-nodelay", "--no-buffer", "https://api.anthropic.com/v1/messages" }
[INFO] 2025-05-24 20:46:18
[Agent] Initiated
[DEBUG] 2025-05-24 20:46:18
Executor:execute -
test
tool[DEBUG] 2025-05-24 20:46:18
FuncExecutor:orchestrate 1
[DEBUG] 2025-05-24 20:46:18
Args: {
response = "Hello World! Test execution successful."
}
[DEBUG] 2025-05-24 20:46:18
FuncExecutor:run
[DEBUG] 2025-05-24 20:46:18
Executor:success
[DEBUG] 2025-05-24 20:46:18
Tool output: {
_index = 2,
["function"] = {
arguments = '{"response": "Hello World! Test execution successful."}',
name = "test"
},
id = "toolu_01GD8NsMundwELjextz8oAj2",
type = "function"
}
[DEBUG] 2025-05-24 20:46:18
Executor:close
[DEBUG] 2025-05-24 20:46:18
Executor:execute - Queue empty
[INFO] 2025-05-24 20:46:18
Chat request finished
[INFO] 2025-05-24 20:46:18
[Agent] Completed
[INFO] 2025-05-24 20:46:31
Chat request started
[INFO] 2025-05-24 20:46:31
Request body file: /tmp/nvim.username/f75GPa/1.json
[DEBUG] 2025-05-24 20:46:31
Request:
{ "-sSL", "-D", "/run/user/1000/plenary_curl_0fb24f45.headers", "-X", "POST", "-H", "X-Api-Key: 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", "-H", "Anthropic-Version: 2023-06-01", "-H", "Content-Type: application/json", "-H", "Anthropic-Beta: prompt-caching-2024-07-31", "-d", "@/tmp/nvim.username/f75GPa/1.json", "--retry", "3", "--retry-delay", "1", "--keepalive-time", "60", "--connect-timeout", "10", "--tcp-nodelay", "--no-buffer", "https://api.anthropic.com/v1/messages" }
[INFO] 2025-05-24 20:46:34
[Agent] Initiated
[DEBUG] 2025-05-24 20:46:34
Executor:execute -
test
tool[DEBUG] 2025-05-24 20:46:34
FuncExecutor:orchestrate 1
[DEBUG] 2025-05-24 20:46:34
Args: {
response = "Manual test execution - Hello World!"
}
[DEBUG] 2025-05-24 20:46:34
FuncExecutor:run
[DEBUG] 2025-05-24 20:46:34
Executor:success
[DEBUG] 2025-05-24 20:46:34
Tool output: {
_index = 1,
["function"] = {
arguments = '{"response": "Manual test execution - Hello World!"}',
name = "test"
},
id = "toolu_01RPJxYhUNcWH2NtiNK9y5jE",
type = "function"
}
[DEBUG] 2025-05-24 20:46:34
Executor:close
[DEBUG] 2025-05-24 20:46:34
Executor:execute - Queue empty
[DEBUG] 2025-05-24 20:46:34
[Subscription] Actioning: (6988525)
[DEBUG] 2025-05-24 20:46:34
[Subscription] Unsubscribing (6988525)
[INFO] 2025-05-24 20:46:34
Chat request finished
[INFO] 2025-05-24 20:46:34
[Agent] Completed
[DEBUG] 2025-05-24 20:46:36
[Subscription] Auto-submitting
[DEBUG] 2025-05-24 20:46:36
Removing tool schema and usage flag for ID: test
[INFO] 2025-05-24 20:46:36
Chat request started
[INFO] 2025-05-24 20:46:36
Request body file: /tmp/nvim.username/f75GPa/2.json
[DEBUG] 2025-05-24 20:46:36
Request:
{ "-sSL", "-D", "/run/user/1000/plenary_curl_9c724a39.headers", "-X", "POST", "-H", "X-Api-Key: sk-ant-XXX, "-H", "Anthropic-Version: 2023-06-01", "-H", "Content-Type: application/json", "-H", "Anthropic-Beta: prompt-caching-2024-07-31", "-d", "@/tmp/nvim.username/f75GPa/2.json", "--retry", "3", "--retry-delay", "1", "--keepalive-time", "60", "--connect-timeout", "10", "--tcp-nodelay", "--no-buffer", "https://api.anthropic.com/v1/messages" }
[INFO] 2025-05-24 20:46:39
Chat request finished
Have you provided and tested with a repro.lua file?
The text was updated successfully, but these errors were encountered: