qwen-code/docs
Harjoth Khara 22006ebf81
fix(core): cap the effort tier at what each endpoint accepts (#9501)
* fix(core): cap the DashScope effort tier at what its ladder accepts

`/effort max` writes the tier into config, and the DashScope provider
emitted it as a flat `reasoning_effort` for the qwen3.8-max family
without checking the endpoint's ladder, which stops at `xhigh`. The
server rejected it with a 400, and because the tier lives in config
every later request in the session rebuilt the same body and 400d too.
The tier also persists to settings.json, so new sessions re-broke.

`max` exists only as a DeepSeek extension. Declare the tiers DashScope
accepts and clamp through the existing `clampReasoningEffort`, warning
once, the same way the Anthropic generator caps tiers its model lacks.

Only the configured `reasoning.effort` is clamped. An explicit
`reasoning_effort` in `extra_body` or `samplingParams` is a documented
verbatim override and still ships unchanged.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): cap the effort tier at what each endpoint accepts

Follow-up on the same defect at the generic layer, per cross-model review.

The unified ladder ends at `max`, but `max` is a vendor extension: DeepSeek
and GLM-5.2+ take it, and a generic OpenAI-compatible endpoint stops at
`xhigh`. The effort-ladder design already specifies OpenAI `max -> xhigh`,
but nothing implemented it, so a configured `max` reached the wire raw and
400d every later request in the session.

Declare the accepted tiers on the provider and clamp there. The base
provider ceilings at `xhigh`; DeepSeek and Z.ai override to the full ladder.
The override is on the provider class, not the hostname, because which tiers
a model accepts is a property of the model while the flat-vs-nested wire
shape is a property of the endpoint: a self-hosted deepseek-* or glm-* model
reached through the model-name fallback still understands `max`.

Also corrects a wrong claim from the first commit. `max` is not
DeepSeek-only: Anthropic opus/sonnet 4.6+ and every 5.x family accept it
natively, and the DashScope note now says only that this family does not.

Adds the warn-once and alias coverage the review found missing.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): scope the effort ceiling to verified endpoints

Closes four gaps the cross-model review found in the previous commit.

The clamp rewrote a `reasoning` object the user set in `samplingParams`.
The pipeline hands those keys straight to the wire and skips the injection
entirely, so that object is the user's own value and documented to ship
verbatim. Skip the clamp when it is present.

DashScope overrides buildRequest without calling super, and only capped its
own flat qwen field, so a non-qwen model on a DashScope host still shipped a
raw nested `max`. Route that branch through the generic ceiling, carving out
GLM-5.2+, which does accept `max`.

The DeepSeek and Z.ai ladders were keyed on the provider class, but both
classes also route on a model-name substring, so anything merely named
`deepseek-*` or `glm-*` claimed a tier its endpoint may reject. Gate both on
the verified hostname, which is the rule deepseek.ts already documents for
decisions about DeepSeek's own wire shape (#3613). Z.ai additionally gates on
GLM-5.2+ rather than every `glm-*`, matching what its comment claimed.

One existing DeepSeek test asserted a self-hosted deepseek-* keeps `max`.
That was the old no-clamp behavior; an unverified endpoint now gets the
generic ceiling, and the test says so.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* docs(core): document the effort ceiling per endpoint

Adds the Z.ai/GLM row, notes that DeepSeek's `max` is hostname-gated, and
says plainly that a `reasoning` object inside `samplingParams` is the user's
own value and is not clamped.

Also adds the end-to-end pipeline test for the generic provider, mirroring
the DashScope one: it drives pipeline.execute and asserts on the body handed
to the SDK.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): answer the effort ceiling for the wire model

The capability check read the configured model, but the pipeline resolves
`request.model || contentGeneratorConfig.model`, so a request-level model
override was answered against the wrong model. Configuring Z.ai `glm-5.2`
and requesting `glm-4.6` shipped a raw `max` again, which is the failure
this change exists to prevent. `supportedReasoningEfforts` becomes
`supportedReasoningEffortsFor(model)` and takes the wire model.

Drops the GLM exception on DashScope. It contradicted this PR's own docs,
which say a `glm-*` model reached on a non-Z.ai host keeps the generic
ceiling, and there is no evidence DashScope's GLM deployment accepts `max`.
A quiet downgrade is the safer side to be wrong on. This also removes the
import of Z.ai's helper from the DashScope provider.

Adds the warn-once test for the base provider and regression tests that
cross the configured and request models in both directions.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 02:14:15 +00:00
..
assets feat: support workspace display names (#7179) 2026-07-20 15:16:44 +00:00
design refactor(cli): extract ACP skill management (#8865) 2026-08-24 01:18:22 +00:00
developers feat(mcp): add MCP 2026 core and WebShell Apps host (#8992) 2026-08-23 18:34:30 +00:00
e2e-tests fix(cli): Recover sessions across archive races (#9513) 2026-08-22 14:01:59 +00:00
images fix(web-shell): render built-in tag icons (#7024) 2026-07-17 15:33:34 +00:00
plans feat(cua-driver): add versioned Computer Use SDK and release pipeline (#9587) 2026-08-23 14:20:14 +00:00
superpowers feat(cli): reference prior sessions via @ and add completion tabs (#7302) 2026-07-24 06:11:48 +00:00
users fix(core): cap the effort tier at what each endpoint accepts (#9501) 2026-08-24 02:14:15 +00:00
verification/abort-controller-refactor fix(core): stop AbortSignal listener leak in long sessions (MaxListenersExceededWarning) (#4366) 2026-05-26 14:21:49 +08:00
_meta.ts feat: refactor docs 2025-12-05 10:51:57 +08:00
index.md fix: lint issues 2025-12-19 15:52:11 +08:00