Skip to content

Give a single-wave hosted review a slot it can finish in - #157

Merged
morgaesis merged 2 commits into
mainfrom
fix/hosted-review-model-slot
Aug 18, 2026
Merged

morgaesis merged 2 commits into
mainfrom
fix/hosted-review-model-slot

Conversation

@morgaesis

Copy link
Copy Markdown
Contributor

About a tenth of hosted reviews were ending with a Model provider unavailable finding on answers the provider was still delivering. The per-model slot exists so a large review's batch waves all fit inside the generator phase, but it was pinned to LARGE_DIFF_LLM_REQUEST_TIMEOUT_SECS for every hosted review rather than to the timeout the review itself selected. A review that fits in one wave therefore ran under a many-wave bound, and because the slot then equalled the phase remainder the timeout retry was unreachable: one attempt, no retry, terminal.

Measured over the last 800 production model calls, z-ai/glm-5.2 answers at a median of 16s but a p95 of 85s and a p99 of 142s, so the cut landed just past p90. SINGLE_WAVE_LLM_REQUEST_TIMEOUT_SECS sits above that tail and clear of the scheduling reserve that ensure_hosted_review_schedule enforces against the deadline remaining once the diff has been fetched; a slot equal to the phase is refused there before any provider request, which the evaluator suite now covers.

The request is not streamed, so a model that is thinking and a socket that is dead are indistinguishable to the caller. Raising the bound buys headroom rather than removing that blind spot.

The per-model slot exists so a large review's batch waves all fit inside
the generator phase, but it was pinned to the large-diff constant for
every hosted review rather than to the timeout the review itself
selected. A single-wave review therefore ran under a many-wave bound:
each model call was cut at sixty seconds, and because the slot then
equalled the phase remainder the timeout retry was unreachable, so one
slow answer ended the review with a provider-unavailable finding.

The review model's own latency sits well above that cut, so a tenth of
hosted reviews were failing on answers that were still arriving.
The generator phase admits a model operation only when the slot still
fits the deadline that remains once the diff has been fetched, less the
scheduling reserve. A slot set to the full hosted request timeout equals
the phase itself and is refused before any provider request, so the
single-wave slot is its own bound, above the review model's tail latency
and clear of the reserve.
@morgaesis
morgaesis merged commit 7cea941 into main Aug 18, 2026
10 checks passed
@morgaesis
morgaesis deleted the fix/hosted-review-model-slot branch August 18, 2026 22:16
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