mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 11:33:14 +00:00
fix: Handle invalid tool names better (#43)
* fix: Handle invalid tool names better * cr
This commit is contained in:
parent
0fbcaa3131
commit
81fa410f03
2 changed files with 26 additions and 2 deletions
|
|
@ -66,8 +66,22 @@ export async function takeAction(
|
|||
const tool = toolsMap[toolCall.name];
|
||||
|
||||
if (!tool) {
|
||||
throw new Error(`Unknown tool: ${toolCall.name}`);
|
||||
logger.error(`Unknown tool: ${toolCall.name}`);
|
||||
return new Command({
|
||||
goto: "progress-plan-step",
|
||||
update: {
|
||||
messages: [
|
||||
new ToolMessage({
|
||||
tool_call_id: toolCall.id ?? "",
|
||||
content: `Unknown tool: ${toolCall.name}`,
|
||||
name: toolCall.name,
|
||||
status: "error",
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!state.sandboxSessionId) {
|
||||
throw new Error(
|
||||
"Failed to take action: No sandbox session ID found in state.",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,17 @@ export async function takeAction(
|
|||
const tool = toolsMap[toolCall.name];
|
||||
|
||||
if (!tool) {
|
||||
throw new Error(`Unknown tool: ${toolCall.name}`);
|
||||
logger.error(`Unknown tool: ${toolCall.name}`);
|
||||
return {
|
||||
plannerMessages: [
|
||||
new ToolMessage({
|
||||
tool_call_id: toolCall.id ?? "",
|
||||
content: `Unknown tool: ${toolCall.name}`,
|
||||
name: toolCall.name,
|
||||
status: "error",
|
||||
}),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
let result = "";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue