Skip to content

Server: a greedy-only engine's sampled request is refused before admission - #582

Merged
ashhart merged 1 commit into
ashhart:mainfrom
BobClawblaw:greedy-only-refused-early
Oct 10, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
BobClawblaw:greedy-only-refused-early

Conversation

@BobClawblaw

Copy link
Copy Markdown
Contributor

Problem

The native GLM-5.3-Flash engine decodes greedily only. It refuses a request with temperature > 0 from backend.prefill (error.GreedyOnly), and by then the server has already admitted the request. The client gets HTTP 500, or, when streaming, an error event inside a stream that has already opened.

Agent clients send a temperature with every request: hermes does, for example. They hit this on every call, and only after waiting their turn in the queue (one stream on this engine). One example from a served log: ended ... reason=error (the native GLM-5.3-Flash engine decodes greedily only: send temperature 0) prompt=338 tokens=0 after=8.46s.

Change

  • engine_api.Info.greedy_only (default false). The GLM host sets it.
  • Server.resolveSampling refuses a request whose resolved temperature is above 0 when the engine is greedy-only. It's a 400 invalid_request_error: "this engine decodes greedily only: send temperature 0 or leave it out". It comes before admission and before any stream opens.
  • The backend's own error.GreedyOnly check stays as the engine-side guard.

Tests

  • New stream_preflight_test.zig case: on a greedy-only engine, a streamed request with temperature: 0.7 is a 400 with no stream opened and the preparing count returned. temperature: 0 and an unset temperature are both served.
  • zig build test -Dcpu=apple_m1: 129/129 steps, 946/948 tests passed (2 skipped). zig build test-golden: 0 differ (the corpus's engines are not greedy-only).

A downstream alternative is to serve such requests greedily instead of refusing them, which is what our GLM recipe does for agent clients. That changes what a request means, so I've kept it out of this PR. It could be an opt-in flag if you'd like it.

…ssion

The native GLM engine decodes greedily only and refused a request with a
temperature from its backend, after the server had admitted it: a 500, or an
error inside an already-open stream. Info.greedy_only lets the server refuse
it while preparing, as a 400 before any stream opens.
@ashhart ashhart mentioned this pull request Oct 10, 2026
@ashhart
ashhart merged commit a0893ed into ashhart:main Oct 10, 2026
1 of 2 checks passed
@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @BobClawblaw. This is in main as a0893ed, merged as it was, so a sampled request to GLM-5.3-Flash gets its 400 before it waits its turn. Our follow-up 58c45ee does two more things:

  • Flash Next decodes greedily only too, and refused a temperature after admission the same way, so it sets greedy_only as well.
  • A server whose generation_config.json samples by default (Flash Next's says temperature 1.0) refuses a request that leaves the temperature out, so "leave it out" was the wrong advice there. That case now says to send temperature 0 or serve with --temperature 0. A host test covers both messages.

Serving such requests greedily instead stays out, as you suggested, since it changes what a request asks for. It ships in the next release. Thanks again!

BobClawblaw pushed a commit to BobClawblaw/TensorFold that referenced this pull request Oct 10, 2026
…l names --temperature 0 when the server samples by default

Flash Next decodes greedily only and refused a temperature after admission, as GLM did before ashhart#582; its Info now
sets greedy_only. A greedy-only server whose generation_config samples by default refuses a request that leaves the
temperature out, so that refusal says to send temperature 0 or serve with --temperature 0.
BobClawblaw pushed a commit to BobClawblaw/TensorFold that referenced this pull request Oct 10, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…l names --temperature 0 when the server samples by default

Flash Next decodes greedily only and refused a temperature after admission, as GLM did before ashhart#582; its Info now
sets greedy_only. A greedy-only server whose generation_config samples by default refuses a request that leaves the
temperature out, so that refusal says to send temperature 0 or serve with --temperature 0.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
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.

2 participants