From 9eb4a4a481636ed228b8c8149ab856524217ac37 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Wed, 25 Feb 2026 23:20:55 -0800 Subject: [PATCH] fix: gateway credential resolution, memory flush auth, and LLM_MODEL fallback - Custom endpoint (OPENAI_API_KEY/OPENAI_BASE_URL) now works in gateway and cron - Memory flush on /reset passes credentials to temp agent - LLM_MODEL env var fallback matches CLI priority chain - Obsidian skill: replace hardcoded paths with OBSIDIAN_VAULT_PATH env var - Setup wizard: strip emojis from TerminalMenu to fix macOS rendering - execute_code: allowlist-filter child process environment variables Co-authored-by: VencentSoliman <4spacetuna@gmail.com> --- gateway/run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index a3a1464a..e332991d 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -769,9 +769,15 @@ class GatewayRunner: if old_history: from run_agent import AIAgent loop = asyncio.get_event_loop() + # Resolve credentials so the flush agent can reach the LLM + _flush_api_key = os.getenv("OPENAI_API_KEY") or os.getenv("OPENROUTER_API_KEY", "") + _flush_base_url = os.getenv("OPENAI_BASE_URL") or os.getenv("OPENROUTER_BASE_URL", "https://openrouter.ai/api/v1") + _flush_model = os.getenv("HERMES_MODEL") or os.getenv("LLM_MODEL", "anthropic/claude-opus-4.6") def _do_flush(): tmp_agent = AIAgent( - model=os.getenv("HERMES_MODEL", "anthropic/claude-opus-4.6"), + model=_flush_model, + api_key=_flush_api_key, + base_url=_flush_base_url, max_iterations=5, quiet_mode=True, enabled_toolsets=["memory"], @@ -1395,7 +1401,7 @@ class GatewayRunner: # Custom endpoint (OPENAI_*) takes precedence, matching CLI behavior api_key = os.getenv("OPENAI_API_KEY") or os.getenv("OPENROUTER_API_KEY", "") base_url = os.getenv("OPENAI_BASE_URL") or os.getenv("OPENROUTER_BASE_URL", "https://openrouter.ai/api/v1") - model = os.getenv("HERMES_MODEL", "anthropic/claude-opus-4.6") + model = os.getenv("HERMES_MODEL") or os.getenv("LLM_MODEL") or "anthropic/claude-opus-4.6" try: import yaml as _y