From abf71fdb4e178e4957da248736a3e066416efe0a Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Tue, 4 Aug 2026 19:40:16 -0500 Subject: [PATCH 1/5] fix(core): hide platform errors from tool output --- packages/core/src/session/to-session-error.ts | 6 ++--- packages/core/test/session-error.test.ts | 17 ++++++++++++++ packages/core/test/tool-shell.test.ts | 22 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/packages/core/src/session/to-session-error.ts b/packages/core/src/session/to-session-error.ts index 0a57bb296db7..54173c8d7cbb 100644 --- a/packages/core/src/session/to-session-error.ts +++ b/packages/core/src/session/to-session-error.ts @@ -1,6 +1,7 @@ import { AIError, ToolFailure } from "@opencode-ai/ai" import { Tool } from "@opencode-ai/schema/tool" import { SessionError } from "@opencode-ai/schema/session-error" +import { PlatformError } from "effect/PlatformError" import { Permission } from "../permission" import { Question } from "../question" import { Integration } from "../integration" @@ -40,10 +41,9 @@ export function toSessionError(cause: unknown): SessionError.Error { if (cause instanceof Question.RejectedError) return { type: "aborted", message: cause.message } if (cause instanceof ToolFailure || cause instanceof Tool.Error) { if (cause.error === undefined) return { type: "tool.execution", message: cause.message } - // The canonical error is the sole model-visible representation, so a cause - // with no message must not erase the tool's curated failure message. const unwrapped = toSessionError(cause.error) - return unwrapped.message === "" ? { ...unwrapped, type: "tool.execution", message: cause.message } : unwrapped + // Platform errors are internal diagnostics; tools provide the model-facing context. + return cause.error instanceof PlatformError ? { ...unwrapped, message: cause.message } : unwrapped } if (cause instanceof StepFailedError) return cause.error if (cause instanceof AgentNotFoundError) return { type: "unknown", message: cause.message } diff --git a/packages/core/test/session-error.test.ts b/packages/core/test/session-error.test.ts index 72f8ebf85ed5..96f3c5519740 100644 --- a/packages/core/test/session-error.test.ts +++ b/packages/core/test/session-error.test.ts @@ -22,6 +22,7 @@ import { Permission } from "@opencode-ai/core/permission" import { Tool } from "@opencode-ai/schema/tool" import { toSessionError } from "@opencode-ai/core/session/to-session-error" import { SessionRunnerRetry } from "@opencode-ai/core/session/runner/retry" +import { systemError } from "effect/PlatformError" const llm = (reason: AIError["reason"]) => new AIError({ module: "test", method: "stream", reason }) @@ -72,6 +73,22 @@ describe("toSessionError", () => { type: "tool.execution", message: "failed", }) + expect( + toSessionError( + new ToolFailure({ + message: "Unable to execute command: pwd", + error: systemError({ + _tag: "NotFound", + module: "FileSystem", + method: "stat", + pathOrDescriptor: "/missing", + }), + }), + ), + ).toEqual({ + type: "unknown", + message: "Unable to execute command: pwd", + }) }) test("preserves provider HTTP status", () => { diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts index 64ea83996054..b8c3d8b7b2ec 100644 --- a/packages/core/test/tool-shell.test.ts +++ b/packages/core/test/tool-shell.test.ts @@ -257,6 +257,28 @@ describe("ShellTool", () => { ), ) + it.live("hides filesystem details when the workdir does not exist", () => + Effect.acquireUseRelease( + Effect.promise(() => tmpdir()), + (tmp) => { + reset() + return withSession(tmp.path, (registry) => + executeTool(registry, call({ command: cwdCommand, workdir: "missing" })), + ).pipe( + Effect.andThen((settled) => + Effect.sync(() => + expect(settled).toEqual({ + status: "error", + error: { type: "unknown", message: `Unable to execute command: ${cwdCommand}` }, + }), + ), + ), + ) + }, + (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]().then(() => undefined)), + ), + ) + it.live("permissions compound commands separately", () => Effect.acquireUseRelease( Effect.promise(() => tmpdir()), From b9431ea22e9990a2d1f8487aacfce585669070ca Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Tue, 4 Aug 2026 19:47:48 -0500 Subject: [PATCH 2/5] fix(core): format platform tool errors --- packages/core/src/session/to-session-error.ts | 41 ++++++++++++++- packages/core/test/session-error.test.ts | 52 ++++++++++++++++++- packages/core/test/tool-shell.test.ts | 7 ++- 3 files changed, 94 insertions(+), 6 deletions(-) diff --git a/packages/core/src/session/to-session-error.ts b/packages/core/src/session/to-session-error.ts index 54173c8d7cbb..a0a7d5c17660 100644 --- a/packages/core/src/session/to-session-error.ts +++ b/packages/core/src/session/to-session-error.ts @@ -42,8 +42,9 @@ export function toSessionError(cause: unknown): SessionError.Error { if (cause instanceof ToolFailure || cause instanceof Tool.Error) { if (cause.error === undefined) return { type: "tool.execution", message: cause.message } const unwrapped = toSessionError(cause.error) - // Platform errors are internal diagnostics; tools provide the model-facing context. - return cause.error instanceof PlatformError ? { ...unwrapped, message: cause.message } : unwrapped + return cause.error instanceof PlatformError + ? { ...unwrapped, message: `${cause.message}: ${platformErrorMessage(cause.error)}` } + : unwrapped } if (cause instanceof StepFailedError) return cause.error if (cause instanceof AgentNotFoundError) return { type: "unknown", message: cause.message } @@ -64,3 +65,39 @@ function providerError(type: string, reason: AIError["reason"]): SessionError.Er ("http" in reason ? reason.http?.response?.status : undefined) ?? ("status" in reason ? reason.status : undefined) return { type, message: reason.message, ...(status === undefined ? {} : { status }) } } + +function platformErrorMessage(error: PlatformError) { + const reason = error.reason + if (reason._tag === "BadArgument") + return `${reason.module}.${reason.method} rejected an invalid argument${reason.description ? `: ${reason.description}` : ""}` + + const label = (() => { + switch (reason._tag) { + case "AlreadyExists": + return "already exists" + case "BadResource": + return "resource is invalid or closed" + case "Busy": + return "resource is busy" + case "InvalidData": + return "invalid data" + case "NotFound": + return "not found" + case "PermissionDenied": + return "permission denied" + case "TimedOut": + return "timed out" + case "UnexpectedEof": + return "unexpected end of input" + case "Unknown": + return "system error" + case "WouldBlock": + return "would block" + case "WriteZero": + return "wrote zero bytes" + } + })() + const target = reason.pathOrDescriptor === undefined ? "" : `: ${reason.pathOrDescriptor}` + const description = reason.description === undefined ? "" : ` (${reason.description})` + return `${reason.module}.${reason.method} failed: ${label}${target}${description}` +} diff --git a/packages/core/test/session-error.test.ts b/packages/core/test/session-error.test.ts index 96f3c5519740..2c0ef2d8e385 100644 --- a/packages/core/test/session-error.test.ts +++ b/packages/core/test/session-error.test.ts @@ -22,7 +22,7 @@ import { Permission } from "@opencode-ai/core/permission" import { Tool } from "@opencode-ai/schema/tool" import { toSessionError } from "@opencode-ai/core/session/to-session-error" import { SessionRunnerRetry } from "@opencode-ai/core/session/runner/retry" -import { systemError } from "effect/PlatformError" +import { badArgument, systemError } from "effect/PlatformError" const llm = (reason: AIError["reason"]) => new AIError({ module: "test", method: "stream", reason }) @@ -87,7 +87,7 @@ describe("toSessionError", () => { ), ).toEqual({ type: "unknown", - message: "Unable to execute command: pwd", + message: "Unable to execute command: pwd: FileSystem.stat failed: not found: /missing", }) }) @@ -108,6 +108,54 @@ describe("toSessionError", () => { }) }) + test("formats every platform error reason for the model", () => { + const reasons = [ + ["AlreadyExists", "already exists"], + ["BadResource", "resource is invalid or closed"], + ["Busy", "resource is busy"], + ["InvalidData", "invalid data"], + ["NotFound", "not found"], + ["PermissionDenied", "permission denied"], + ["TimedOut", "timed out"], + ["UnexpectedEof", "unexpected end of input"], + ["Unknown", "system error"], + ["WouldBlock", "would block"], + ["WriteZero", "wrote zero bytes"], + ] as const + + for (const [tag, message] of reasons) { + expect( + toSessionError( + new ToolFailure({ + message: "Tool failed", + error: systemError({ + _tag: tag, + module: "FileSystem", + method: "operation", + pathOrDescriptor: "/target", + description: "OS detail", + }), + }), + ), + ).toEqual({ + type: "unknown", + message: `Tool failed: FileSystem.operation failed: ${message}: /target (OS detail)`, + }) + } + + expect( + toSessionError( + new ToolFailure({ + message: "Tool failed", + error: badArgument({ module: "FileSystem", method: "operation", description: "invalid path" }), + }), + ), + ).toEqual({ + type: "unknown", + message: "Tool failed: FileSystem.operation rejected an invalid argument: invalid path", + }) + }) + test("retries only rate limits, provider-internal failures, and transport failures", () => { const eligible = [ llm(new RateLimitReason({ message: "rate" })), diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts index b8c3d8b7b2ec..41bc64f74984 100644 --- a/packages/core/test/tool-shell.test.ts +++ b/packages/core/test/tool-shell.test.ts @@ -257,7 +257,7 @@ describe("ShellTool", () => { ), ) - it.live("hides filesystem details when the workdir does not exist", () => + it.live("formats filesystem details when the workdir does not exist", () => Effect.acquireUseRelease( Effect.promise(() => tmpdir()), (tmp) => { @@ -269,7 +269,10 @@ describe("ShellTool", () => { Effect.sync(() => expect(settled).toEqual({ status: "error", - error: { type: "unknown", message: `Unable to execute command: ${cwdCommand}` }, + error: { + type: "unknown", + message: `Unable to execute command: ${cwdCommand}: FileSystem.stat failed: not found: ${path.join(tmp.path, "missing")}`, + }, }), ), ), From 3b6db1d6d6b1d0e369d95b11da9d958259583386 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Tue, 4 Aug 2026 19:59:07 -0500 Subject: [PATCH 3/5] fix(core): clarify platform tool failures --- packages/core/src/session/to-session-error.ts | 12 ++-- packages/core/src/tool/plugin/shell.ts | 12 +++- packages/core/test/session-error.test.ts | 59 +++++++------------ packages/core/test/tool-shell.test.ts | 6 +- 4 files changed, 40 insertions(+), 49 deletions(-) diff --git a/packages/core/src/session/to-session-error.ts b/packages/core/src/session/to-session-error.ts index a0a7d5c17660..f19f04095f19 100644 --- a/packages/core/src/session/to-session-error.ts +++ b/packages/core/src/session/to-session-error.ts @@ -41,10 +41,11 @@ export function toSessionError(cause: unknown): SessionError.Error { if (cause instanceof Question.RejectedError) return { type: "aborted", message: cause.message } if (cause instanceof ToolFailure || cause instanceof Tool.Error) { if (cause.error === undefined) return { type: "tool.execution", message: cause.message } + if (cause.error instanceof PlatformError) + return { type: "tool.execution", message: `${cause.message}: ${platformErrorMessage(cause.error)}` } const unwrapped = toSessionError(cause.error) - return cause.error instanceof PlatformError - ? { ...unwrapped, message: `${cause.message}: ${platformErrorMessage(cause.error)}` } - : unwrapped + if (unwrapped.message === "") return { ...unwrapped, type: "tool.execution", message: cause.message } + return unwrapped } if (cause instanceof StepFailedError) return cause.error if (cause instanceof AgentNotFoundError) return { type: "unknown", message: cause.message } @@ -57,6 +58,7 @@ export function toSessionError(cause: unknown): SessionError.Error { ) return { type: "provider.no-route", message: cause.message } if (cause instanceof Integration.AuthorizationError) return { type: "provider.auth", message: cause.message } + if (cause instanceof PlatformError) return { type: "unknown", message: platformErrorMessage(cause) } return { type: "unknown", message: cause instanceof Error ? cause.message : String(cause) } } @@ -69,7 +71,7 @@ function providerError(type: string, reason: AIError["reason"]): SessionError.Er function platformErrorMessage(error: PlatformError) { const reason = error.reason if (reason._tag === "BadArgument") - return `${reason.module}.${reason.method} rejected an invalid argument${reason.description ? `: ${reason.description}` : ""}` + return `invalid argument${reason.description ? `: ${reason.description}` : ""}` const label = (() => { switch (reason._tag) { @@ -99,5 +101,5 @@ function platformErrorMessage(error: PlatformError) { })() const target = reason.pathOrDescriptor === undefined ? "" : `: ${reason.pathOrDescriptor}` const description = reason.description === undefined ? "" : ` (${reason.description})` - return `${reason.module}.${reason.method} failed: ${label}${target}${description}` + return `${label}${target}${description}` } diff --git a/packages/core/src/tool/plugin/shell.ts b/packages/core/src/tool/plugin/shell.ts index 8a8ce3d707b0..55450a26fb8e 100644 --- a/packages/core/src/tool/plugin/shell.ts +++ b/packages/core/src/tool/plugin/shell.ts @@ -176,7 +176,12 @@ export const Plugin = { agent: context.agent, source, }) - if ((yield* fsUtil.stat(target.canonical)).type !== "Directory") + const workdir = yield* fsUtil.stat(target.canonical).pipe( + Effect.catchReason("PlatformError", "NotFound", () => + Effect.fail(new ToolFailure({ message: `Working directory does not exist: ${target.canonical}` })), + ), + ) + if (workdir.type !== "Directory") return yield* Effect.fail(new Error(`Working directory is not a directory: ${target.canonical}`)) }), ) @@ -280,7 +285,10 @@ export const Plugin = { } }), Effect.mapError( - (error) => new ToolFailure({ message: `Unable to execute command: ${input.command}`, error }), + (error) => + error instanceof ToolFailure + ? error + : new ToolFailure({ message: `Unable to execute command: ${input.command}`, error }), ), ), }), diff --git a/packages/core/test/session-error.test.ts b/packages/core/test/session-error.test.ts index 2c0ef2d8e385..dbcd722ee768 100644 --- a/packages/core/test/session-error.test.ts +++ b/packages/core/test/session-error.test.ts @@ -86,8 +86,12 @@ describe("toSessionError", () => { }), ), ).toEqual({ - type: "unknown", - message: "Unable to execute command: pwd: FileSystem.stat failed: not found: /missing", + type: "tool.execution", + message: "Unable to execute command: pwd: not found: /missing", + }) + expect(toSessionError(new ToolFailure({ message: "Tool failed", error: new Error("") }))).toEqual({ + type: "tool.execution", + message: "Tool failed", }) }) @@ -108,41 +112,18 @@ describe("toSessionError", () => { }) }) - test("formats every platform error reason for the model", () => { - const reasons = [ - ["AlreadyExists", "already exists"], - ["BadResource", "resource is invalid or closed"], - ["Busy", "resource is busy"], - ["InvalidData", "invalid data"], - ["NotFound", "not found"], - ["PermissionDenied", "permission denied"], - ["TimedOut", "timed out"], - ["UnexpectedEof", "unexpected end of input"], - ["Unknown", "system error"], - ["WouldBlock", "would block"], - ["WriteZero", "wrote zero bytes"], - ] as const - - for (const [tag, message] of reasons) { - expect( - toSessionError( - new ToolFailure({ - message: "Tool failed", - error: systemError({ - _tag: tag, - module: "FileSystem", - method: "operation", - pathOrDescriptor: "/target", - description: "OS detail", - }), - }), - ), - ).toEqual({ - type: "unknown", - message: `Tool failed: FileSystem.operation failed: ${message}: /target (OS detail)`, - }) - } - + test("formats platform errors for the model", () => { + const missing = systemError({ + _tag: "NotFound", + module: "FileSystem", + method: "operation", + pathOrDescriptor: "/target", + description: "OS detail", + }) + expect(toSessionError(missing)).toEqual({ + type: "unknown", + message: "not found: /target (OS detail)", + }) expect( toSessionError( new ToolFailure({ @@ -151,8 +132,8 @@ describe("toSessionError", () => { }), ), ).toEqual({ - type: "unknown", - message: "Tool failed: FileSystem.operation rejected an invalid argument: invalid path", + type: "tool.execution", + message: "Tool failed: invalid argument: invalid path", }) }) diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts index 41bc64f74984..219eb1f34646 100644 --- a/packages/core/test/tool-shell.test.ts +++ b/packages/core/test/tool-shell.test.ts @@ -257,7 +257,7 @@ describe("ShellTool", () => { ), ) - it.live("formats filesystem details when the workdir does not exist", () => + it.live("reports a missing workdir", () => Effect.acquireUseRelease( Effect.promise(() => tmpdir()), (tmp) => { @@ -270,8 +270,8 @@ describe("ShellTool", () => { expect(settled).toEqual({ status: "error", error: { - type: "unknown", - message: `Unable to execute command: ${cwdCommand}: FileSystem.stat failed: not found: ${path.join(tmp.path, "missing")}`, + type: "tool.execution", + message: `Working directory does not exist: ${path.join(tmp.path, "missing")}`, }, }), ), From bfc1521a63342ec5fefc2eba26b1141e88699e94 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Tue, 4 Aug 2026 20:50:37 -0500 Subject: [PATCH 4/5] refactor(core): keep shell error local --- packages/core/src/session/to-session-error.ts | 45 ++---------------- packages/core/test/session-error.test.ts | 46 ------------------- 2 files changed, 3 insertions(+), 88 deletions(-) diff --git a/packages/core/src/session/to-session-error.ts b/packages/core/src/session/to-session-error.ts index f19f04095f19..0a57bb296db7 100644 --- a/packages/core/src/session/to-session-error.ts +++ b/packages/core/src/session/to-session-error.ts @@ -1,7 +1,6 @@ import { AIError, ToolFailure } from "@opencode-ai/ai" import { Tool } from "@opencode-ai/schema/tool" import { SessionError } from "@opencode-ai/schema/session-error" -import { PlatformError } from "effect/PlatformError" import { Permission } from "../permission" import { Question } from "../question" import { Integration } from "../integration" @@ -41,11 +40,10 @@ export function toSessionError(cause: unknown): SessionError.Error { if (cause instanceof Question.RejectedError) return { type: "aborted", message: cause.message } if (cause instanceof ToolFailure || cause instanceof Tool.Error) { if (cause.error === undefined) return { type: "tool.execution", message: cause.message } - if (cause.error instanceof PlatformError) - return { type: "tool.execution", message: `${cause.message}: ${platformErrorMessage(cause.error)}` } + // The canonical error is the sole model-visible representation, so a cause + // with no message must not erase the tool's curated failure message. const unwrapped = toSessionError(cause.error) - if (unwrapped.message === "") return { ...unwrapped, type: "tool.execution", message: cause.message } - return unwrapped + return unwrapped.message === "" ? { ...unwrapped, type: "tool.execution", message: cause.message } : unwrapped } if (cause instanceof StepFailedError) return cause.error if (cause instanceof AgentNotFoundError) return { type: "unknown", message: cause.message } @@ -58,7 +56,6 @@ export function toSessionError(cause: unknown): SessionError.Error { ) return { type: "provider.no-route", message: cause.message } if (cause instanceof Integration.AuthorizationError) return { type: "provider.auth", message: cause.message } - if (cause instanceof PlatformError) return { type: "unknown", message: platformErrorMessage(cause) } return { type: "unknown", message: cause instanceof Error ? cause.message : String(cause) } } @@ -67,39 +64,3 @@ function providerError(type: string, reason: AIError["reason"]): SessionError.Er ("http" in reason ? reason.http?.response?.status : undefined) ?? ("status" in reason ? reason.status : undefined) return { type, message: reason.message, ...(status === undefined ? {} : { status }) } } - -function platformErrorMessage(error: PlatformError) { - const reason = error.reason - if (reason._tag === "BadArgument") - return `invalid argument${reason.description ? `: ${reason.description}` : ""}` - - const label = (() => { - switch (reason._tag) { - case "AlreadyExists": - return "already exists" - case "BadResource": - return "resource is invalid or closed" - case "Busy": - return "resource is busy" - case "InvalidData": - return "invalid data" - case "NotFound": - return "not found" - case "PermissionDenied": - return "permission denied" - case "TimedOut": - return "timed out" - case "UnexpectedEof": - return "unexpected end of input" - case "Unknown": - return "system error" - case "WouldBlock": - return "would block" - case "WriteZero": - return "wrote zero bytes" - } - })() - const target = reason.pathOrDescriptor === undefined ? "" : `: ${reason.pathOrDescriptor}` - const description = reason.description === undefined ? "" : ` (${reason.description})` - return `${label}${target}${description}` -} diff --git a/packages/core/test/session-error.test.ts b/packages/core/test/session-error.test.ts index dbcd722ee768..72f8ebf85ed5 100644 --- a/packages/core/test/session-error.test.ts +++ b/packages/core/test/session-error.test.ts @@ -22,7 +22,6 @@ import { Permission } from "@opencode-ai/core/permission" import { Tool } from "@opencode-ai/schema/tool" import { toSessionError } from "@opencode-ai/core/session/to-session-error" import { SessionRunnerRetry } from "@opencode-ai/core/session/runner/retry" -import { badArgument, systemError } from "effect/PlatformError" const llm = (reason: AIError["reason"]) => new AIError({ module: "test", method: "stream", reason }) @@ -73,26 +72,6 @@ describe("toSessionError", () => { type: "tool.execution", message: "failed", }) - expect( - toSessionError( - new ToolFailure({ - message: "Unable to execute command: pwd", - error: systemError({ - _tag: "NotFound", - module: "FileSystem", - method: "stat", - pathOrDescriptor: "/missing", - }), - }), - ), - ).toEqual({ - type: "tool.execution", - message: "Unable to execute command: pwd: not found: /missing", - }) - expect(toSessionError(new ToolFailure({ message: "Tool failed", error: new Error("") }))).toEqual({ - type: "tool.execution", - message: "Tool failed", - }) }) test("preserves provider HTTP status", () => { @@ -112,31 +91,6 @@ describe("toSessionError", () => { }) }) - test("formats platform errors for the model", () => { - const missing = systemError({ - _tag: "NotFound", - module: "FileSystem", - method: "operation", - pathOrDescriptor: "/target", - description: "OS detail", - }) - expect(toSessionError(missing)).toEqual({ - type: "unknown", - message: "not found: /target (OS detail)", - }) - expect( - toSessionError( - new ToolFailure({ - message: "Tool failed", - error: badArgument({ module: "FileSystem", method: "operation", description: "invalid path" }), - }), - ), - ).toEqual({ - type: "tool.execution", - message: "Tool failed: invalid argument: invalid path", - }) - }) - test("retries only rate limits, provider-internal failures, and transport failures", () => { const eligible = [ llm(new RateLimitReason({ message: "rate" })), From 8be555edd7966ad81190bbf0b4bf951bdbaa88c9 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Tue, 4 Aug 2026 20:54:46 -0500 Subject: [PATCH 5/5] refactor(core): simplify shell workdir error --- packages/core/src/tool/plugin/shell.ts | 7 ++----- packages/core/test/tool-shell.test.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/core/src/tool/plugin/shell.ts b/packages/core/src/tool/plugin/shell.ts index 55450a26fb8e..16fe6a5f7749 100644 --- a/packages/core/src/tool/plugin/shell.ts +++ b/packages/core/src/tool/plugin/shell.ts @@ -178,7 +178,7 @@ export const Plugin = { }) const workdir = yield* fsUtil.stat(target.canonical).pipe( Effect.catchReason("PlatformError", "NotFound", () => - Effect.fail(new ToolFailure({ message: `Working directory does not exist: ${target.canonical}` })), + Effect.fail(new Error(`Working directory does not exist: ${target.canonical}`)), ), ) if (workdir.type !== "Directory") @@ -285,10 +285,7 @@ export const Plugin = { } }), Effect.mapError( - (error) => - error instanceof ToolFailure - ? error - : new ToolFailure({ message: `Unable to execute command: ${input.command}`, error }), + (error) => new ToolFailure({ message: `Unable to execute command: ${input.command}`, error }), ), ), }), diff --git a/packages/core/test/tool-shell.test.ts b/packages/core/test/tool-shell.test.ts index 219eb1f34646..dfee4e12448d 100644 --- a/packages/core/test/tool-shell.test.ts +++ b/packages/core/test/tool-shell.test.ts @@ -270,7 +270,7 @@ describe("ShellTool", () => { expect(settled).toEqual({ status: "error", error: { - type: "tool.execution", + type: "unknown", message: `Working directory does not exist: ${path.join(tmp.path, "missing")}`, }, }),