server: answer reasoning_effort levels the template rejects with 400 (#32332)

The reasoning effort probe already renders every candidate level, but
it dropped the ones the template raises on, so a request with such a
level (e.g. max on Qwen3.8) reached the template and came back as a
500 on /v1/chat/completions, /v1/responses and /v1/messages.

Keep the raising levels in reasoning_effort_rejected and reject them
in oaicompat_chat_params_parse with an invalid_argument, which the
server answers with a 400 listing the supported levels. Aliases and
levels a template ignores are not rejected, so high on Qwen3.8
still renders as xhigh.

Also trim the output_config.effort test to a single level.
This commit is contained in:
Pascal authored and GitHub committed 2026-11-16 06:55:56 +01:00
1 parent 05db09a4d3
commit a946eb541a
8 files changed
+54 -4

No files matched your search

+11
View File
@@ -8614,6 +8614,17 @@ static void test_reasoning_effort_caps() {
assert_effort_levels("models/templates/openai-gpt-oss-120b.jinja", all_levels);
assert_effort_levels("models/templates/Cohere2MoE.jinja", {});
assert_effort_levels("models/templates/Qwen-Qwen3-0.6B.jinja", {});
auto assert_effort_rejected = [](const std::string & path, const std::vector<std::string> & expected) {
auto tmpls = read_templates(path);
assert_equals(json(expected).dump(), common_chat_templates_get_caps(tmpls.get()).at("reasoning_effort_rejected").dump());
};
assert_effort_rejected("models/templates/IFM-K2-Horizon.jinja", { "minimal", "xhigh", "max" });
assert_effort_rejected("models/templates/tencent-Hy3.jinja", { "minimal", "medium", "xhigh", "max" });
assert_effort_rejected("models/templates/deepseek-ai-DeepSeek-V4.jinja", {});
assert_effort_rejected("models/templates/openai-gpt-oss-120b.jinja", {});
assert_effort_rejected("models/templates/Cohere2MoE.jinja", {});
}
static void test_msg_diffs_compute() {