Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
#5076: fold the retry gate's comment and guard so openai-chat.ts stays at 1,000 lines (unlisted cap)
milind-soni446bf82a94ab
diff --git a/server/drivers/openai-chat.ts b/server/drivers/openai-chat.tsindex 6ae38e41bc..22f440a48e 100644--- a/server/drivers/openai-chat.ts+++ b/server/drivers/openai-chat.ts@@ -714,13 +714,9 @@ export function createOpenAIChatRuntime<Config>(options: RuntimeOptions<Config>)tools.definitions.length = 0;continue;}- // Once a call has been handled, never replay it through a turn retry.- // A stream closed before any completion marker executed nothing upstream, so exactly- // that protocol error may resend — even where the caller never opted into retries.- const truncation = error instanceof StreamTruncatedError;- const retryScale = truncation ? options.retryScale ?? 1 : options.retryScale;- if (retryScale === undefined || abort.signal.aborted || streamed || seenCalls.size ||- (error instanceof ChatProtocolError && !truncation) || (!verdict.transient && !truncation) || attempt >= RETRY_MAX_ATTEMPTS - 1) throw error;+ // Never replay a handled call. A stream closed before any completion marker ran nothing upstream, so it may resend even where the caller never opted into retries.+ const truncation = error instanceof StreamTruncatedError, retryScale = truncation ? options.retryScale ?? 1 : options.retryScale;+ if (retryScale === undefined || abort.signal.aborted || streamed || seenCalls.size || (!truncation && (error instanceof ChatProtocolError || !verdict.transient)) || attempt >= RETRY_MAX_ATTEMPTS - 1) throw error;const delayMs = computeBackoff(attempt++);emit({ ...base(turn.threadId, turnId), type: "turn.retrying", attempt, delayMs, reason: truncation ? "stream_truncated" : verdict.reason });await interruptibleDelay(delayMs * retryScale, abort.signal).promise;