fix(core): continue after unavailable tool calls

This commit is contained in:
Kit Langton
2026-07-07 21:05:29 -04:00
parent 1f9305b3af
commit 83f25e88b6
3 changed files with 15 additions and 3 deletions
+9
View File
@@ -365,6 +365,15 @@ const layer = Layer.effect(
return
}
needsContinuation = true
if (!advertisedTools.has(event.name)) {
yield* serialized(
publisher.failUnsettledTools({
type: "tool.execution",
message: `Tool is not available for this request: ${event.name}`,
}),
)
return
}
const assistantMessageID = yield* publisher.assistantMessageID(event.id)
ownedToolFibers.push(
yield* Effect.uninterruptibleMask((restore) =>
+2 -2
View File
@@ -273,9 +273,9 @@ function withLocation<A, E, R>(
function mutablePlugin(description: string) {
const plugin = pathToFileURL(path.join(import.meta.dir, "../../../plugin/src/v2/promise/index.ts")).href
return `
import { define } from ${JSON.stringify(plugin)}
import { Plugin } from ${JSON.stringify(plugin)}
export default EffectPlugin.define({
export default Plugin.define({
id: "mutable-plugin",
setup: async (ctx) => {
await ctx.agent.transform((agents) => {
+4 -1
View File
@@ -2674,7 +2674,10 @@ describe("SessionRunnerLLM", () => {
{
type: "tool",
id: "call-missing",
state: { status: "error", error: { message: "Unknown tool: missing" } },
state: {
status: "error",
error: { type: "tool.execution", message: "Tool is not available for this request: missing" },
},
},
],
},