-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: tool_schema.output.rejected getting function as action #1081
Labels
bug
Something isn't working
Comments
Important If your issue does NOT contain a valid Thanks @ravitemer. I'll get to this as soon as I can. In the meantime, please ensure:
|
---Setup the tool to be executed
---@param input? any
---@return nil
function Executor:setup(input)
if self.queue:is_empty() then
finalize_agent(self)
return log:debug("Executor:execute - Queue empty")
end
if self.agent.status == self.agent.constants.STATUS_ERROR then
finalize_agent(self)
return log:debug("Executor:execute - Error")
end
-- Get the next tool to run
self.tool = self.queue:pop()
-- Setup the handlers
self:setup_handlers()
self.handlers.setup() -- Call this early as cmd_runner needs to setup its cmds dynamically
-- Get the first command to run
local cmd = self.tool.cmds[1]
log:debug("Executor:execute - `%s` tool", self.tool.name)
-- Check if the tool requires approval
if self.tool.opts and self.tool.opts.requires_approval and not vim.g.codecompanion_auto_tool_mode then
log:debug("Executor:execute - Asking for approval")
local prompt = self.output.prompt(self.tool)
if prompt == nil or prompt == "" then
prompt = ("Run the %q tool?"):format(self.tool.name)
end
local ok, choice = pcall(vim.fn.confirm, prompt, "&Yes\n&No\n&Cancel")
if not ok or choice == 0 or choice == 3 then -- Esc or Cancel
log:debug("Executor:execute - Tool cancelled")
finalize_agent(self)
return self:close()
end
if choice == 1 then -- Yes
log:debug("Executor:execute - Tool approved")
self:execute(cmd, input)
end
if choice == 2 then -- No
log:debug("Executor:execute - Tool rejected")
self.output.rejected(cmd)
return self:setup()
end
else
self:execute(cmd, input)
end
end the |
Thanks for catching this @ravitemer. Fixed this in the latest patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you check the docs and existing issues?
Neovim version (nvim -v)
0.10
Operating system/version
ubuntu 22
Describe the bug
ravitemer/mcphub.nvim#10
Error occurs when rejecting a tool call with builtin @files tool as well.
Steps To Reproduce
Use builtin @files tool and reject.
Expected Behavior
action should be a table
init.lua file
Log output
Error executing vim.schedule lua callback: ...lazy/mcphub.nvim/lua/mcphub/extensions/codecompanion.lua:155: attempt to index local 'action' (a function value)
stack traceback:
...lazy/mcphub.nvim/lua/mcphub/extensions/codecompanion.lua:155: in function 'rejected'
...a/codecompanion/strategies/chat/agents/executor/init.lua:59: in function 'rejected'
...a/codecompanion/strategies/chat/agents/executor/init.lua:127: in function 'f'
Have you provided and tested with a repro.lua file?
The text was updated successfully, but these errors were encountered: