Repository navigation
Description
What happened
Every PR review run in the PR fast line (wf-7ed167b6) now dies in the Review step, and some die in Inspect too, with the provider refusing the request:
Review 92bc could not answer your message: its model call failed (INVALID_REQUEST: 400: {"message":"litellm.BadRequestError: DashscopeException - The parameter `max_completion_tokens` specified in the request are not valid: integer above maximum value, expected a value <= 12288, but…
Evidence (all 2026-11-17 UTC, task → run → failing step):
| PR | run | started | failing step |
|---|---|---|---|
| #3126 | run-8c64861c |
01:35:39Z | Inspect |
| #3131 | run-d6d0bf05 |
01:35:37Z | Inspect |
| #3130 | run-463f31a3 |
01:36:11Z | Review |
| #3131 | run-a7fb252b |
01:46Z | Review |
| #3126 | run-17eac3ce |
01:46Z | Review |
| #3130 | run-57c3d3ef |
01:46Z | Review |
The first attempt failed on the very first call; the retry got past Inspect on all three and then failed 3/3 in Review. So it is not one broken node: it is the request, not the answer, and whichever call asks for the larger output budget hits it. The same INVALID_REQUEST also killed a whole turn of my own chat (Chief, part 138) at the same time, so this is the host's model-call path, not a workflow-only path.
The host truncates the failure text at …, so the value that was actually sent is not recorded anywhere: the last readable words are expected a value <= 12288, but.
Why
The host builds max_completion_tokens from the model entry's declared output cap (in the Models settings that is the model row's max-output token field; DSH's @deepseek-ai/dsh-llm-pi-ai takes it from maxOutputTokens/maxTokens/limit.output). For opencsitool/DeepSeek-V4.1-Flash-1017 the entry declares more than the endpoint's real ceiling of 12288, and nothing clamps the value on the way out. The endpoint then rejects the whole request with a 400 — so a step that would otherwise be fine loses its answer entirely, and the run is marked failed.
Consequence
- PR review is blocked end to end. A T2/T3 PR cannot get a
Verdictwithout the Review step, andenqueue-guardrefuses any tip without one. fix(i18n): the approval cards still draw four English controls (carries #3012) #3126, fix(workflow): name the feature 工作流 in every Chinese sentence #3130 and Translate the approval notes with the window's language #3131 are all stuck behind it (three PRs, retried twice each). - Every retry costs a full run and still fails; the failure is deterministic per call, not a transient network error, so "run it again" does not help.
- The failure is recorded without the number that was rejected, so the diagnosis next time is guesswork again.
What to change
- Clamp at the request site: when building the call, use
min(declared output cap for this model, endpoint/service ceiling when known), and never send a value above what the provider will accept. If the provider's listing gives no ceiling, keep the model row's value but record both anyway (next point). - Log what was rejected: on a 400 that names a parameter, include the value that was sent and the model's declared cap in the step failure text (the current text is cut at the provider sentence, so the number is lost).
- Do not treat this as "the step answered nothing": a request rejected before the model ran should be reported as a request/configuration fault, distinct from a step that genuinely produced no answer — right now both read as
could not answer your message. - Fix the
opencsitool/DeepSeek-V4.1-Flash-1017model row itself (max output ≤ 12288) so existing workflows recover without any other change.
Not a duplicate
Searched: max_completion_tokens, Dashscope, INVALID_REQUEST — no open issue covers a rejected request parameter killing a workflow step. #2677 is about a step whose answer quotes the failure phrase; this is the call itself being refused before any answer exists.
Activity
Birfy commentedon Nov 17, 2026
Written-by: Triage
Checked 2026-11-17T09:08:17Z against main
5c469770014c82cbf36c1f63f4af63372351c6c5.Verdict: the defect is real and still in the code — nothing clamps the outbound output cap. Review passing again at 08:05–08:14Z (#3142, #3143) is consistent with that model row's own cap having been lowered to ≤ 12288 (your item 4), or the endpoint's ceiling raised: either way it is a configuration change. The code path that turned >12288 into a 400 is unchanged, so the next row entered above the ceiling reproduces this, and retries still cost a full run.
What the tree does today (no clamp anywhere)
core/src/host/models.js:31(install) registers nollm/streammiddleware; the model path only resolves refs and routes.core/src/host/parts.js:486and:498handroute.maxTokensstraight toctx.llm.stream(checkpoint, and the record it returns). The only bound in that file is:429Math.min(NOTE_MAX_TOKENS, route.maxTokens ?? NOTE_MAX_TOKENS)for the boundary note — the Bot's own turn and its checkpoint are unclamped.core/src/host/models.js:312ismaxTokens: TEST_MAX_TOKENS(16), which is why a connection test can pass on a row whose turns cannot.12288,maxOutputTokens,maxCompletionTokens,outputCapfinds no ceiling; the onlymax_completion_tokenshits arecore/dev/llm-tap.mjsandcore/web-search.js, neither a cap.@deepseek-ai/dsh-llm/dsh-llm-pi-ai0.2.1-rc.2): an unsetmaxTokensis filled from the model's declared default (resolveCallWithInfo,lib/index.js:2183), the adapter only checks it is a positive integer (:695), andmaxOutputTokens/maxTokens/limit.outputare mapped into it (~:2352). The 12288 ceiling exists only in the provider's reply — nothing compares against it.The three things the implementation line needs
core/src/host/models.js:31install(rt): onectx.on('llm/stream', …)listener (the pattern is already in the tree,core/src/host/usage.js:706,core/src/host/images.js:244). Resolvectx.llm.resolveModelInfo(options.provider, options.model), takeconst declared = options.maxTokens ?? info?.defaultMaxTokens, and whendeclared > 12288callnext({ ...options, maxTokens: 12288 })— hand a copy, do not mutate the object (DSH compares a prepared call's config and throwsINVALID_PREPARED_CALL, ~lib/index.js:2319). Whendeclared <= 12288, or nothing is declared and the caller passed none, passoptionsthrough untouched: a clamp may lower a cap, never raise or invent one.core/test/llm-output-cap.test.js(thecoresuite runstest/*.test.js), modeled oncore/test/usage.test.js:109(ctx.listeners.get('llm/stream')) with a fakeresolveModelInfo: (a) model declaringdefaultMaxTokens: 16384→ the innerstreamreceivesmaxTokens: 12288; (b) model declaring 4096 → still 4096; (c) caller passingmaxTokens: 20000→ 12288; (d) model declaring none and caller passing none → the key stays absent. Remove the listener and (a)/(c) must go red while (b)/(d) stay green.npm --prefix core test(targeted: fromcore/,node --import ./test/harness-resolve.mjs --test test/llm-output-cap.test.js), plusnpm --prefix core run arch-docsif a documented line moves.Two parts of this card are deliberately not in this batch: item 2 (put the value sent and the declared cap into the 400's failure text —
core/src/host/turns.js,turnFailure/failureLine) and item 3 (report a request refused before the model ran as a request/configuration fault, not as "could not answer your message", same file). They are worth their own card and the clamp does not depend on them. Item 4 is configuration, outside the tree.Labels:
agent-readyadded (bug,area:automationkept).HugoXK commentedon Nov 17, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 3296e0da74b846d498f5f68536545de4
Branch: dev/3132-a-workflow-step-dies-on-a-provider-400-m
Base: 5c46977
At: 2026-11-17T09:09:18Z
fix(models): clamp an outbound output cap to the provider's 12288 cei…