memorix icon indicating copy to clipboard operation
memorix copied to clipboard

LLM_CALL_TIMEOUT_MS is hardcoded at 12s — causes timeouts with proxy-routed models

Open RaviTharuma opened this issue 7 months ago • 2 comments

Problem

LLM_CALL_TIMEOUT_MS is hardcoded to 12000ms in src/llm/provider.ts. When using LLM providers behind a proxy (e.g., CLIProxyAPI/Quotio routing to Chutes, Fireworks, etc.), the routing + model cold start regularly exceeds 12 seconds.

This causes:

  • Endless LLM compact failed, falling back to heuristic log spam on every store/search/deduplicate operation
  • Process instability — the timeout cascade can overwhelm the Node.js event loop, eventually crashing the background control plane
  • Effective disabling of LLM enhanced mode — every compact/formation/rerank call falls back to heuristic, making the LLM config useless

Related hardcoded timeouts with the same issue:

  • FORMATION_TIMEOUT_MS = 12000ms (line ~11569)
  • COMPRESSION_TIMEOUT_MS = 5000ms (line ~11570)
  • DEDUP_PER_PAIR_TIMEOUT_MS = 5000ms (line ~11571)
  • RERANK_TIMEOUT_MS = 5000ms (line ~3096)

Environment

  • memorix v1.0.6
  • LLM: deepseek-v3.2 via Quotio/CLIProxyAPI proxy → Chutes/Fireworks
  • macOS, background control plane mode (HTTP transport)

Expected behavior

LLM call timeouts should be configurable via:

  • config.json (e.g., "llm": { "timeoutMs": 30000 })
  • Environment variable (e.g., MEMORIX_LLM_TIMEOUT_MS)
  • Or at minimum, sensible defaults for proxy scenarios (30s+)

Workaround

Manually patching dist/index.js:

LLM_CALL_TIMEOUT_MS = 3e4;        // 30s (was 12s)
FORMATION_TIMEOUT_MS = 3e4;        // 30s (was 12s)
COMPRESSION_TIMEOUT_MS = 15e3;     // 15s (was 5s)
DEDUP_PER_PAIR_TIMEOUT_MS = 15e3;  // 15s (was 5s)

RaviTharuma avatar Apr 05 '26 17:04 RaviTharuma

Thanks for the detailed write-up. We agree the hardcoded LLM timeout family is too rigid for proxy-routed or cold-start-heavy providers, and we plan to address this in the next release. We’ll look at the broader timeout family together, not just the top-level LLM_CALL_TIMEOUT_MS, so the fix actually resolves the instability/fallback problem end-to-end.

AVIDS2 avatar Apr 08 '26 03:04 AVIDS2

Great, looking forward to it. The broader timeout family approach makes sense — the cascading failures from a single hardcoded value affect multiple code paths. Let me know if you want me to help scope the changes.

RaviTharuma avatar Apr 08 '26 17:04 RaviTharuma