mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5766] [MERGED] fix(llm): keep GLM 5.3 reasoning mandatory on every provider path #6923
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6923
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5766
Author: @Romuromylus
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @Romuromylus
Base:
staging← Head:fix/5765-glm-53-mandatory-reasoning📝 Commits (8)
117105efix(llm): keep GLM 5.3 reasoning mandatory on every provider path (#5765)2b06ad4style(llm): format the GLM 5.3 compat import per Prettierd653755test(regressions): drop an unrelated reformat from the provider-compat harnessb61af1bfix(llm): keep the explicit reasoning disable for GLM 5.3 on local inference hosts398b22cMerge branch 'staging' into fix/5765-glm-53-mandatory-reasoning0915d23Merge branch 'staging' into fix/5765-glm-53-mandatory-reasoning62d8320Merge remote-tracking branch 'pasta/staging' into fix/5765-glm-53-mandatory-reasoningb75c71cfix(llm): forward a configured GLM 5.3 effort on remote custom gateways📊 Changes
4 files changed (+233 additions, -16 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/services/llm/providers/glm-request-compat.ts(+66 -4)📝
packages/server/src/services/llm/providers/openai.provider.ts(+17 -4)📝
scripts/regressions/provider-compat.regression.ts(+149 -8)📄 Description
Linked issue
Closes #5765
Why this change
Agent runs on a GLM 5.3 connection fail with
Custom OpenAI-compatible endpoint error 400: This model always engages in thinking and cannot be disabled; please use low, high, or max(Z.AI) orNanoGPT API error 400: GLM 5.3 always thinks and does not support disabling reasoning.(NanoGPT), no matter which reasoning effort the user picks.Root cause: JSON agents ask for reasoning off (
jsonResponseReasoningOverrideinpackages/server/src/services/agents/agent-executor.tssetsreasoningEffort: "none"and forces the send-switch on, which is why the reporter's low/high attempts made no difference). #5582 taught the provider layer that GLM 5.3 Flash cannot honor that, but the guard (isGlm53FlashMandatoryReasoningModel) matched only the Flash name, so plainglm-5.3/z-ai/glm-5.3still received a disable:enable_thinking: false(applyGlmThinkingParameters),enable_thinking: false,reasoning: { effort: "none" }(supportsOpenRouterReasoningDisableallowed everyz-ai/glm-*except Flash),reasoning_effort: "none".Z.AI documents that GLM-5.3 and GLM-5.3-Flash always reason, that
thinking.type: "disabled"is no longer supported, and that only thelow,high, andmaxeffort levels are accepted (their migration note says to sendenabled+reasoning_effort: "low"where an app used to disable). Chat generation only appeared to work because the chat path sends nothing for a GLM model on a custom connection unless the user explicitly turns reasoning off.What changed
packages/server/src/services/llm/providers/glm-request-compat.tsisGlm53MandatoryReasoningModelreplaces the Flash-only guard and matches every GLM 5.3 variant (glm-5.3,glm-5.3-flash, provider prefixes and:free-style suffixes;glm-5.30,glm-5.2and friends do not match).glm53ReasoningEffortmaps Marinara's effort onto the three accepted levels:none/minimal/low→low,medium/high→high,xhigh/max→max, no effort → provider default.applyGlmThinkingParametersnow handles GLM 5.3 first: native Z.AI endpoints send the documentedthinking: { type: "enabled" }plus the mappedreasoning_effort(instead of the legacyenable_thinkingflag), NanoGPT sendsenable_thinking: trueplus the mapped effort. GLM 5.2 and older GLM models keep their existing bodies.packages/server/src/services/llm/providers/openai.provider.tsz-ai/glm-5.3keeps the provider's mandatory-reasoning default.reasoning_effort: "low"instead of"none"for GLM 5.3 on a remote non-native gateway (glm53CustomGatewayReasoningEffort); a local inference host (loopback / LAN /.local, perisLocalInferenceBaseUrl) keeps"none"plus the existingenable_thinking: falsetemplate kwarg, because self-hosted GLM 5.3 weights can really turn thinking off. Every other model still sends"none"everywhere.scripts/regressions/provider-compat.regression.ts: pins for the model guard (incl.glm-5.30negative), the effort map, native Z.AI off/default/medium bodies, NanoGPT and OpenRouter non-Flash GLM 5.3 requests through the real provider, the custom-gateway substitution pinned on a remote and a local base URL, and a non-GLM control that still sends"none".CHANGELOG.md: Unreleased → Fixed entry.Not in scope: the JSON-agent reasoning-off policy itself (it is still the right default for every model that can honor it), and the model catalog entries for GLM 5.3.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
z-ai/glm-5.3andz-ai/glm-5.3-flash:enable_thinking: false,reasoning_effort: "none", andthinking.type: "disabled"all return HTTP 400reasoning_required;enable_thinking: truewithreasoning_effortlow/high/maxreturns 200 with content. Z.AI's GLM-5.3 docs and thinking-mode guide state the same contract for the native endpoint.z-ai/glm-5.3, disabled the agent fallback connection, ran Retry Failed Agents on a roleplay chat →NanoGPT API error 400: GLM 5.3 always thinks and does not support disabling reasoning.game_state_update.node ./scripts/run-regressions.mjs --filter scripts/regressions/provider-compat.regression.tspasses;tsc --noEmiton@marinara-engine/serveris clean.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable (server request shaping only).
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.