Skip to content

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

Keep the provider's words out of the server log: status and failure class only

stph l7643d9d70bf7
diff --git a/server/index.ts b/server/index.ts
index 40bfdd0737..44a4cd2e6a 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -209,7 +209,8 @@ import {
type SteerOutcome,
newId,
} from "./contracts.ts";
-import { RETRY_MAX_ATTEMPTS } from "./drivers/retry.ts";
+import { httpStatusOf } from "./drivers/engine-errors.ts";
+import { classifyError, RETRY_MAX_ATTEMPTS } from "./drivers/retry.ts";
import { chosenBackups, recoveryCapabilityError, startupBackups } from "./automatic-recovery.ts"; import { outOfProcesses } from "./process-shortage.ts";
import { createQuotaSwitchHost } from "./host/quota-switch.ts"; import { quotaSwitchEnabled } from "./quota-switch.ts"; import { createPeerLimitResend } from "./host/peer-limit-resend.ts"; import { createRoomLimitTakeover } from "./host/room-limit-takeover.ts";
import { decodeGeneratedImage } from "./generated-image.ts";
@@ -6625,7 +6626,8 @@ bus.subscribe((event: RuntimeEvent) => {
pushStoppedTurn(event.turnId);
break;
}
- console.warn(`[omb-turn] thread=${event.threadId} turn=${event.turnId ?? "none"} failed: ${redactSecretsInText(event.message).replace(/\s+/g, " ").slice(0, 600)}`);
+ // Only the status and the failure's class: a provider's words can name the account, and the server log is read by more people than the chat.
+ { const status = httpStatusOf(event.message); console.warn(`[omb-turn] thread=${event.threadId} turn=${event.turnId ?? "none"} failed: ${classifyError({ text: event.message }).reason}${status ? ` HTTP ${status}` : ""}`); }
landParkedFiles(); // above the failure row, which stays the last, retryable line
pushMessage({ role: "bot", kind: "activity", tool: failedTurnTool(event.message, event) });
if (event.setup && bot) store.setTaskActivity(bot.id, event.threadId, "dead");
diff --git a/server/provider-error-digest.e2e.test.ts b/server/provider-error-digest.e2e.test.ts
index 0769c83b4c..4ea0e8e0a3 100644
--- a/server/provider-error-digest.e2e.test.ts
+++ b/server/provider-error-digest.e2e.test.ts
@@ -4,11 +4,11 @@ import { expect, it } from "vitest";
import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";
const REJECTIONS = [
- { status: 429, state: "RESOURCE_EXHAUSTED", message: "Quota exceeded for metric: generate_content_free_tier_requests, limit: 20. Please retry in 11h32m" },
- { status: 503, state: "UNAVAILABLE", message: "This model is currently experiencing high demand" },
+ { status: 429, reason: "quota", state: "RESOURCE_EXHAUSTED", message: "Quota exceeded for metric: generate_content_free_tier_requests, limit: 20. Please retry in 11h32m" },
+ { status: 503, reason: "server_error", state: "UNAVAILABLE", message: "This model is currently experiencing high demand" },
] as const;
-it.each(REJECTIONS)("a provider HTTP $status ends the turn as failed, with the provider's words in the chat, the digest and the server log", async ({ status, state, message }) => {
+it.each(REJECTIONS)("a provider HTTP $status ends the turn as failed, with the provider's words in the chat and the digest, and its status in the server log", async ({ status, reason, state, message }) => {
let chatRequests = 0;
const upstream = createServer(async (req, res) => {
if (req.url === "/v1/models") {
@@ -63,7 +63,8 @@ it.each(REJECTIONS)("a provider HTTP $status ends the turn as failed, with the p
expect(digest.text).toContain(`turn failed: ${said}`);
expect(digest.text).not.toContain("synthetic-fixture-key");
const log = readFileSync(fixture.info.logPath, "utf8");
- expect(log).toMatch(new RegExp(`\\[omb-turn\\] thread=\\S+ turn=\\S+ failed: ${said}`));
+ expect(log).toMatch(new RegExp(`\\[omb-turn\\] thread=\\S+ turn=\\S+ failed: ${reason} HTTP ${status}\\n`));
+ expect(log).not.toContain(message);
expect(log).not.toContain("synthetic-fixture-key");
} finally {
await fixture.close();