fix(metadata): accept GOOGLE_GEMINI_API_KEY in gemini_session — host metadata extraction was fully broken #255
Reference in New Issue
Block a user
Delete Branch "worktree-gemini-api-key-name"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
הבעיה
gemini_session._api_key()קרא רקGEMINI_API_KEY, אבל המפתח הקנוני (גם ב-~/.envשל ההוסט וגם ב-Infisical SoTnautilus:/external-apis/gemini) הואGOOGLE_GEMINI_API_KEY. המפתח קיים — רק תחת השם הקנוני — ולכן כל קריאה זרקה"GEMINI_API_KEY אינו מוגדר".התוצאה: כל חילוץ-מטא-דאטה דרך Gemini בהוסט נכשל בשקט (186 שגיאות כאלה בלוג
legal-metadata-drain, אחרונה 2026-06-14). התגלה בעקבות תיק מטא-דאטה בודד שתקוע (1049-06-21).התיקון
_api_key()קוראGEMINI_API_KEYאם מוגדר, אחרת נופל ל-GOOGLE_GEMINI_API_KEY. בלי סוד חדש, בלי כפילות — יישור הקוד לשם-ה-SoT הקיים.אומת חי
_api_key()נפתר (len=53) אחרי טעינת~/.env.gemini_session.query_jsonאמיתית מול ה-API מחזירה{"ok": true}.py_compileנקי.Invariants
🤖 Generated with Claude Code
_api_key() read ONLY `GEMINI_API_KEY`, but the canonical secret (host ~/.env and Infisical SoT nautilus:/external-apis/gemini) is `GOOGLE_GEMINI_API_KEY`. The key was present but under the canonical name → `_api_key()` raised "GEMINI_API_KEY אינו מוגדר" on every call → ALL host precedent-metadata extraction via Gemini failed silently (186 such errors in the legal-metadata-drain err log, latest 2026-06-14). Fix: read GEMINI_API_KEY if set, else fall back to GOOGLE_GEMINI_API_KEY. No new secret, no duplication — aligns the code to the existing SoT name (G1: fix at source). Verified live: _api_key() resolves (len=53) and a real gemini query_json call returns {"ok": true}. Invariants: G1 (fix at source — code reads the canonical secret name, not a parallel/duplicated env var) · X10 (deploy-env-secrets: single SoT name honored). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>