Conversation
a40733c to
574ef66
Compare
| @@ -1,3 +1,16 @@ | |||
| ---@class CodeCompanion.Tools.Orchestrator | |||
| ---@field cancelled boolean? Whether the tool execution has been cancelled | |||
There was a problem hiding this comment.
minor nit but I prefer these to be in alphabetical order as my eyes can find things faster
| local fmt = string.format | ||
| local Orchestrator = {} | ||
|
|
||
| --============================================================================= |
There was a problem hiding this comment.
I'd prefer to skip these public and private blocks as the initial underscore tells us they're private
|
This looks like a fabulous PR, thank you. Very well timed as I intend to add MCP support very soon. This looks good to merge. I'll decide whether to add it to |
Thank you! Would you like me to fix the comments you made, or are you planning on fixing them? |
574ef66 to
6646e64
Compare
Just updated the PR for those two small changes in |
|
Very nice and much-needed PR, thank you Would it make sense to add an option to the function to cancel only the current tool, with a specific keymap (e.g. This could also be handled in a separate PR if preferred. |
I defaulted to a "cancel all" approach, but I can see how you may want to only cancel the current tool call that is stuck. I would think this would belong in a separate PR if its something the maintainer wanted to support |
Description
Currently, tools cannot be cancelled so accidental tool usage or long running tools cannot be stopped without closing the chat window and potentially losing the conversation. This PR allows the user to use the stop keymap in chat to cancel to the tool call and inform the AI agent.
This will kill the process for tools run through cmd_runner, but it does not actually cancel function calls. So tools invoked through something like MCPHub.nvim, or the builtin tools, will continue to execute in the background to completion. To actually cancel the function calls would require a bit more refactoring so I figured that it would be worth a discussion before any further implementation.
I tested this on Linux (Fedora) and Windows.
AI Usage
Claude Sonnet 4.5 did an initial version, but I cleaned it up and essentially rewrote most of it.
Related Issue(s)
Screenshots
Checklist
make allto ensure docs are generated, tests pass and StyLua has formatted the code