Skip to content

fix(eval): give each local model call the task's time budget - #562

Merged
dovvnloading merged 3 commits into
mainfrom
fix/eval-model-request-timeout
Nov 22, 2026
Merged

dovvnloading merged 3 commits into
mainfrom
fix/eval-model-request-timeout

Conversation

@dovvnloading

Copy link
Copy Markdown
Owner

Problem

With real local models, the agent benchmark (tools/agent_eval.py --model ...) reported most failures as model_error at about 25 seconds. With qwen3:8b, 6 of 8 failures were model_error at 25.06 to 25.08 s. With nemotron-3-nano:4b, 3 of them hit 25.06 s on the first call.

Root cause

LoopbackOllamaClient._request opens HTTPConnection(..., timeout=25) for a non-streaming /api/chat. Ollama sends nothing until the whole reply is ready, so that one socket read has to cover model load and the entire generation. A cold load or a long reply therefore times out long before the task's 90 s wall-clock budget.

Change

One constant, TASK_SECONDS = 90, now sets both the task's LoopBudgets.max_seconds and the HTTP read timeout. A slow model now fails on the task's time limit, not as a transport error. Check mode, loopback-only transport and response size limits are unchanged.

Tests

  • test_agent_eval.py: the fake-connection test now records the timeout and asserts both requests use TASK_SECONDS. It fails on main (25).
  • Focused: tests/test_agent_eval.py (56 passed, 6 skipped). tools/agent_eval.py --check passes 10/10. ruff and mypy are clean.

Risk and rollback

Benchmark tooling only. Rollback is reverting this commit.

🤖 Generated with Claude Code

dovvnloading and others added 3 commits November 21, 2026 20:20
The benchmark's loopback Ollama client used a fixed 25 s socket timeout.
A non-streaming /api/chat sends nothing until the whole reply is ready,
so a cold model load or a long reply was reported as model_error at
25 s, far inside the task's 90 s budget. That dominated real-model runs
(6 of 8 qwen3:8b failures were model_error at about 25.1 s).

One constant, TASK_SECONDS, now sets both the task's wall-clock budget
and the read timeout, so a slow model fails on its time limit instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dovvnloading
dovvnloading merged commit 1c7b651 into main Nov 22, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant