From f2ea78d0e4e5d25ab3cc25dc9f1492135630c9be Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 8 Jun 2025 15:42:49 -0700 Subject: fix(tool-scheduler): Correctly pipe cancellation signal to tool calls (#852) --- packages/core/src/tools/shell.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'packages/core/src/tools/shell.ts') diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index 9ced00a4..caef67b9 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -162,6 +162,13 @@ export class ShellTool extends BaseTool { }; } + if (abortSignal.aborted) { + return { + llmContent: 'Command was cancelled by user before it could start.', + returnDisplay: 'Command cancelled by user.', + }; + } + // wrap command to append subprocess pids (via pgrep) to temporary file const tempFileName = `shell_pgrep_${crypto.randomBytes(6).toString('hex')}.tmp`; const tempFilePath = path.join(os.tmpdir(), tempFileName); -- cgit v1.2.3