Bench-runner LLM transport fix: HTTP/1.1 + no pool + 15s header timeout (LlmPolicy)#135
Merged
Conversation
Introduce a LlmPolicy carried on LlmClientConfig so the LLM HTTP client can run stricter under headless eval without changing the desktop app. Default policy is permissive (byte-identical to current app behavior — pooled HTTP/2 via the shared client); LlmPolicy::bench() enables: - http1_only: pin the LLM client to HTTP/1.1 (no h2 negotiation) - no_pool: fresh TCP+TLS per request (pool_max_idle_per_host(0)) - header_timeout_ms: 15s abort if response headers don't arrive LlmClient::new builds a dedicated reqwest::Client when the policy deviates from default; otherwise still clones the shared client. A new retryable AgentError variant HeaderTimeout joins HttpError/ChunkTimeout in the existing turn-level retry path. Matches opencode's working transport shape (HTTP/1.1, fresh sockets, header timeout + SDK retries) which has zero decode deaths on the same router that gave bench-runner deterministic mid-stream resets on long Kimi runs.
The eval harness sets LlmPolicy::bench() so the frozen binary uses the same
HTTP transport shape opencode does on the same router. Always on — part of
the harness identity, no CLI flag.
Also mirror AgentEvent::Error { retrying, message } to stderr so the grid's
stderr_tail captures LLM retry attempts directly. Without this the result JSON
only records the final outcome, leaving us blind to whether retries fired.
Validated off-grid on the chronic dead cell (teleport-1b08 × kimi × ON): old
binary died on decode at turns 6, 9, 11, 20 across 4 attempts; this binary
completed cleanly at 45 turns with empty stderr (no retries triggered — the
underlying truncations stopped happening at the transport layer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bench-runner-only LLM transport fix for the chronic
"error decoding response body"decode deaths on long Kimi/Fireworks runs. Introduces anLlmPolicyonLlmClientConfigmirroring the existingToolPolicypattern: default = byte-identical to today's desktop-app behavior (pooled HTTP/2 via shared client); bench-runner opts intoLlmPolicy::bench()(HTTP/1.1, fresh TCP per request, 15s header-arrival timeout). Matches opencode's working transport shape.Evidence (off-grid validation, chronic dead cell)
teleport-1b08 × kimi × ON— 6 consecutive deterministic decode deaths across eras with v0.1.5:stderr was completely empty on the survivor — no
[bench] llm-error retrying=…lines. The truncations didn't happen; they were prevented at the transport layer. Matches the hypothesis: opencode (HTTP/1.1) had zero decode deaths on the same router/account/model across ~16 heavy Kimi cells.The three changes (all bench-only)
http1_only— pin the LLM client to HTTP/1.1 (no h2 ALPN negotiation).no_pool—pool_max_idle_per_host(0)→ fresh TCP+TLS connection per request, kills connection-reuse / pool-poisoning failure modes.header_timeout_ms: Some(15_000)— abort the request if response headers don't arrive within 15 s. New retryableAgentError::HeaderTimeoutjoins the existingHttpError/ChunkTimeoutretry arm.Plus:
AgentEvent::Error { retrying, message }mirrored to stderr so the grid'sstderr_tailcaptures LLM retry attempts directly.Ships as v0.1.6 (patch).