Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge remote-tracking branch 'upstream/main' into fix/mail-1a1e7ea7-invalid-tool-args

AdityaUmale76f423628818
diff --cc server/drivers/openai-chat.ts
index 40a32e1b76,5e47576a78..aaf86a7d0e
--- a/server/drivers/openai-chat.ts
+++ b/server/drivers/openai-chat.ts
@@@ -789,8 -785,8 +785,8 @@@ export function createOpenAIChatRuntime
if (seenCalls.has(call.id)) throw new ChatProtocolError("provider reused a tool-call ID; refusing to repeat an operation");
seenCalls.add(call.id);
}
- if (seenCalls.size > MAX_TURN_TOOL_CALLS) throw new ChatProtocolError(stoppedAfter(`${MAX_TURN_TOOL_CALLS} tool calls`));
+ if (seenCalls.size > MAX_TURN_TOOL_CALLS) throw new ChatProtocolError(`Stopped after ${MAX_TURN_TOOL_CALLS} tool calls without a final answer. The steps so far already ran, so ask only for what's left.`);
- messages.push(assistantReply(model, completion, completion.text || null, completion.toolCalls));
+ messages.push(assistantReply(model, completion, completion.text || null, replayableToolCalls(completion.toolCalls)));
// A failure stays pending only until the bot runs tools again: one that went on to use more tools has read the error
// and reacted (a wrong guess, a bad query, then the right call), so its turn is not failed for it, on any model. The
// failed step still shows as failed; a failure in the last calls before the answer, or a person's no, still ends it.