Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

[codex] Sanitize text generation CLI errors (#3431)

Julius Marminge621616268af2
diff --git a/apps/server/src/textGeneration/TextGenerationPrompts.test.ts b/apps/server/src/textGeneration/TextGenerationPrompts.test.ts
index 1435bc522..b67e8b93c 100644
--- a/apps/server/src/textGeneration/TextGenerationPrompts.test.ts
+++ b/apps/server/src/textGeneration/TextGenerationPrompts.test.ts
@@ -190,4 +190,16 @@ describe("normalizeCliError", () => {
expect(result).toBeInstanceOf(TextGenerationError);
expect(result.detail).toBe("fallback");
});
+
+ it("does not expose CLI failure details in the public error message", () => {
+ const result = normalizeCliError(
+ "codex",
+ "generateCommitMessage",
+ new Error("request failed with access_token=secret-token"),
+ "Failed to generate a commit message",
+ );
+
+ expect(result.detail).toBe("Failed to generate a commit message");
+ expect(result.message).not.toContain("secret-token");
+ });
});
diff --git a/apps/server/src/textGeneration/TextGenerationUtils.ts b/apps/server/src/textGeneration/TextGenerationUtils.ts
index a786f81b2..ad2911c20 100644
--- a/apps/server/src/textGeneration/TextGenerationUtils.ts
+++ b/apps/server/src/textGeneration/TextGenerationUtils.ts
@@ -99,7 +99,7 @@ export function normalizeCliError(
}
return new TextGenerationError({
operation,
- detail: `${fallback}: ${error.message}`,
+ detail: fallback,
cause: error,
});
}