YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): explain Codex usage limits (#6161)
Ezra Ellettea61c66c9048b
diff --git a/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts b/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.tsindex d4df9c38a..53ddfdf47 100644--- a/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts+++ b/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts@@ -186,6 +186,41 @@ describe("provider error copy", () => {).toContain("ChatGPT account id");});+ it("maps only the full Codex usage-limit signature to sanitized recovery guidance", () => {+ const expected =+ "The AI provider usage limit has been reached. Wait for it to reset, or switch your AI preset or provider.";++ expect(+ buildProviderErrorMessage(+ "Error: CODEX ERROR: THE USAGE LIMIT HAS BEEN REACHED. attacker suffix",+ { provider: "openai-chatgpt", model: "gpt-5.2-codex" },+ ),+ ).toBe(expected);+ expect(expected).not.toContain("attacker suffix");++ for (const raw of [+ "The usage limit has been reached.",+ "Codex error: usage limit has been reached.",+ "Codex error: the usage limit was reached.",+ ]) {+ expect(+ buildProviderErrorMessage(raw, {+ provider: "openai-chatgpt",+ model: "gpt-5.2-codex",+ }),+ ).toBeNull();+ }+ });++ it("keeps hosted quota codes authoritative over the Codex usage-limit phrase", () => {+ expect(+ buildProviderErrorMessage(+ '{"error":"free_chat_limit_exceeded","message":"Codex error: the usage limit has been reached"}',+ { provider: "screenpipe-cloud", model: "auto" },+ ),+ ).toContain("2 free AI messages");+ });+it("does not map unrelated token errors to the ChatGPT account-id message", () => {expect(buildProviderErrorMessage("invalid token", { provider: "openai-chatgpt" })).toBeNull();expect(diff --git a/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts b/apps/screenpipe-app-tauri/lib/chat/provider-errors.tsindex a3ee4aae6..6523d919b 100644--- a/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts+++ b/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts@@ -311,6 +311,10 @@ function buildGenericProviderErrorMessage(}}+ if (normalized.includes("codex error: the usage limit has been reached")) {+ return "The AI provider usage limit has been reached. Wait for it to reset, or switch your AI preset or provider.";+ }+if (provider === "custom" &&(normalized.includes("401") ||