fix: LM transport ceiling per provider (read_timeout_s + num_retries)

The bug his log pinned: local EXTRACT died at 2407.3s = 4 attempts x
600s + 7s backoff — dspy's retry loop (default num_retries=3) ran
honestly but every attempt hit the SAME wall: lm15's default read
timeout of 600s (and the silent-ollama proxy in front cuts at its own
READ_TIMEOUT=600 too). Retries can't help when each attempt dies at
the same ceiling — the 27b on a single 3090 legitimately needs
minutes for a long EXTRACT output (his nvidia-smi: 21GB resident,
64k context, ~52% util).

The fix: the ceiling is CONFIG, not code.
- config.yaml: local read_timeout_s=1800 (one honest 30-min attempt),
  num_retries=1 (one re-try after a genuine cut, not 3x30min);
  ollama-cloud read_timeout_s=300 (glm answers EXTRACT in ~3s),
  num_retries=2 (cloud retries are cheap).
- configure_lm forwards read_timeout_s as dspy.LM(timeout=...) —
  dspy 3.4.1 routes it to lm15 Timeouts(read/write/pool) — and
  num_retries to the retry loop (LMTransportError is retryable).
- run.log first line now reports the ceiling (no more silent 600s
  walls — you SEE what will kill a slow call).
- Unset keys -> dspy defaults (600s / retries 3), nothing invented.

Verified on the wire (tests/lm_transport_wire.py): a hang server +
timeout=3 kills the call at 3.1s (not 600s); num_retries=1 gives
exactly 2 attempts (3.2s = 2x1s + backoff). Suite: 21 files green.
This commit is contained in:
2026-10-26 12:27:49 +01:00
parent 27c4bf3812
commit f31b30d811
5 changed files with 234 additions and 2 deletions
+9
View File
@@ -8,12 +8,21 @@ lm:
model: qwen3.8-27b-uc-64k:latest
max_tokens: 4096
temperature: 0.0
# transport ceiling (fix: EXTRACT hangs >600s on a busy 3090; the
# silent-ollama proxy in front cuts at its own READ_TIMEOUT=600s).
# read_timeout_s -> lm15 Timeouts(read=) — one attempt may run this long.
# num_retries -> dspy's retry loop (LMTransportError is retryable);
# each retry costs up to read_timeout_s, so keep retries LOW locally.
read_timeout_s: 1800 # 30 min: one honest attempt for a long EXTRACT
num_retries: 1 # one re-try after a cut, not 3x30min
ollama-cloud:
base_url: https://ollama.com/v1
model: glm-5.3-flash
max_tokens: 4096
temperature: 0.0
api_key_env: OLLAMA_API_KEY
read_timeout_s: 300 # glm answers EXTRACT in ~3s; 300s bounds a wedged call
num_retries: 2 # cloud retries are cheap
budget:
max_llm_calls: 80 # per FLOOP run (children get a slice; fan-outs multiply