From 978d7f38206e681beae274d4831e6695496c9a1c Mon Sep 17 00:00:00 2001 From: Jim Shingler Date: Mon, 6 Jul 2026 18:52:32 -0400 Subject: [PATCH] Inference.ts: scrub ANTHROPIC_BASE_URL alongside API key/token The nested-claude subprocess spawn deletes ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN from the child env to force subscription billing, but never cleared ANTHROPIC_BASE_URL. If a user has that set to a local proxy (e.g. a LiteLLM gateway used for cost tracking/observability), every nested inference() call -- including the mode/tier classifier that PromptProcessing.hook.ts invokes on every prompt, and the Advisor calls in VERIFY -- kept targeting that proxy, but now with zero valid Anthropic credentials in env. The proxy correctly rejects with 401, the subprocess retries, and the call eats its full timeout before giving up. Observed impact: with ANTHROPIC_BASE_URL set, the mode classifier failed on every single message (Timeout after 25000ms), forcing the fail-safe path instead of real classification, plus a steady stream of 401s in the proxy's logs from the retries. Fixes the reported bug. --- LifeOS/install/LIFEOS/TOOLS/Inference.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LifeOS/install/LIFEOS/TOOLS/Inference.ts b/LifeOS/install/LIFEOS/TOOLS/Inference.ts index f13b5cea0..59d54b896 100755 --- a/LifeOS/install/LIFEOS/TOOLS/Inference.ts +++ b/LifeOS/install/LIFEOS/TOOLS/Inference.ts @@ -162,6 +162,12 @@ async function inferenceAttempt(options: InferenceOptions, modelOverride?: strin // either path leaks subscription work onto API-key billing. Scrub both. delete env.ANTHROPIC_API_KEY; delete env.ANTHROPIC_AUTH_TOKEN; + // Also scrub ANTHROPIC_BASE_URL: if it points at a local proxy (e.g. a + // LiteLLM gateway used for cost tracking/observability), the child process + // would still target that proxy after losing its credentials above, + // causing every nested call to fail auth (401) and retry until timeout. + // Force nested subscription calls straight to Anthropic's real API. + delete env.ANTHROPIC_BASE_URL; const hasImages = options.imagePaths && options.imagePaths.length > 0; const args = [