From 111e8c70a2b09dfe1ca20ade078256e2ac5381ff Mon Sep 17 00:00:00 2001 From: Rutimka <48045755+Rutimka@users.noreply.github.com> Date: Mon, 30 Mar 2026 10:39:12 +0200 Subject: [PATCH] fix(codex): don't crash on startup when quota is exhausted (429) (#744) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 429 usage_limit_reached response during verify_connection() caused the server to refuse to start entirely. Quota exhaustion is not a configuration error — the server should start and serve retain/recall requests normally, it just can't make LLM calls until the quota resets. Co-authored-by: Marco Rutsch Co-authored-by: Claude Sonnet 4.6 --- .../hindsight_api/engine/providers/codex_llm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py b/hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py index 3da61140..dd0c8cb2 100644 --- a/hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py +++ b/hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py @@ -166,6 +166,10 @@ class CodexLLM(LLMInterface): ) logger.info(f"Codex LLM verified: {self.model}") except Exception as e: + # 429 means quota exhausted, not a configuration error — warn but allow startup + if "429" in str(e) or "usage_limit_reached" in str(e): + logger.warning(f"Codex LLM quota exhausted for {self.model}, continuing startup: {e}") + return raise RuntimeError(f"Codex LLM connection verification failed for {self.model}: {e}") from e async def call(