[GH-ISSUE #3498] [Issue]: GLM thinking/reasoning silently broken — client/server default mismatch causes reasoningEffort to drop to null #1893

Closed
opened 2026-10-21 05:43:36 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @xDanteMD on GitHub (Jul 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3498

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When using GLM models (from Zhipu/Z.ai) via the nanogpt provider, thinking/reasoning never activates — even when the user explicitly sets "Reasoning Effort: Maximum" in Advanced Parameters. The brain icon never appears. The root cause is a client/server default mismatch: the client defaults reasoningEffort to "maximum" while the server defaults it to null, causing the client to skip saving the parameter (it thinks it matches the default) and the server to receive null (thinking disabled).

Expected behavior

When a user sets Reasoning Effort to Maximum (or any non-null value) in Advanced Parameters, the model should produce reasoning/thinking output, and the brain icon should appear in the chat.

Actual behavior

The debug log shows:

EnableThinking: false  ShowThoughts: true  Effort: none

Despite the UI showing "Reasoning Effort: Maximum" toggled on. The thinking parameter is never sent to the API.

Root cause analysis

The mismatch

Layer reasoningEffort default Source
Client (UI) "maximum" GenerationParametersEditor.tsx lines 66, 82
Server (runtime) null constants/defaults.ts line 32

How the bug manifests

  1. User opens Advanced Parameters, sees "Reasoning Effort" set to "Maximum" (the client default)
  2. User toggles it on / confirms Maximum — this matches the client default
  3. Client's setParameters() in AdvancedParametersSection.tsx (line 126) compares each parameter against defaults[key]. Since reasoningEffort: "maximum" === defaults.reasoningEffort: "maximum", the parameter is NOT saved to chatParameters
  4. Server receives chatMeta.chatParameters without reasoningEffort
  5. parseStoredGenerationParameters() returns { reasoningEffort: undefined } (not in the stored object)
  6. resolveGenerationProviderRuntime() applies chat params — but undefined doesn't trigger the override at line 94 (if (params.reasoningEffort !== undefined))
  7. runtime.reasoningEffort stays at the server default: null
  8. resolvedEffort = null, enableThinking = false
  9. body.enable_thinking is never set, or set to false — thinking is disabled

Key code locations

  • Client defaults: packages/client/src/components/ui/GenerationParametersEditor.tsx lines 66, 82 — reasoningEffort: "maximum"
  • Server defaults: packages/shared/src/constants/defaults.ts line 32 — reasoningEffort: null
  • Client skip logic: packages/client/src/features/chat-settings/sections/AdvancedParametersSection.tsx line 126 — only saves if different from default
  • Server override gate: packages/server/src/services/generation/provider-generation-runtime.ts line 94 — only applies if !== undefined
  • Resolved to null: packages/server/src/services/generation/provider-generation-runtime.ts line 152 — resolvedEffort = null when reasoningEffort is null

Steps to reproduce

  1. Add a nanogpt connection with a valid API key
  2. Select a GLM model (e.g., glm-4.7)
  3. Open Advanced Parameters (chat settings gear icon)
  4. Observe "Reasoning Effort" is already set to "Maximum" (the client default)
  5. Toggle it on if needed, confirm Maximum is selected
  6. Send a message
  7. Open debug view — notice EnableThinking: false and Effort: none
  8. No brain icon appears, no thinking content is produced

Environment

  • Marinara Engine version: 2.1.1
  • Install type: source (The installer, whatever that works out to)
  • OS + version: Windows 10
  • Browser or app shell: Firefox

Suggested fix

Option A (minimal, recommended): Align the server default with the client default.

In packages/shared/src/constants/defaults.ts, change line 32:

// Before:
reasoningEffort: null,

// After:
reasoningEffort: "maximum",

This ensures that when the client skips saving reasoningEffort (because it matches the default), the server's fallback also defaults to "maximum", and thinking is enabled.

Option B (more robust): Always save reasoningEffort in the client regardless of whether it matches the default. In AdvancedParametersSection.tsx, remove the diff check for reasoningEffort specifically, or change the client default to null to match the server.

Option A is the safest because it doesn't change client storage behavior and aligns with user expectations (Maximum is the sensible default for thinking-enabled models).

Additional context

API format is NOT the issue. Testing confirmed that nanogpt correctly handles enable_thinking: true and returns reasoning content. The Zhipu API documentation specifies thinking: { type: "enabled" } but nanogpt accepts the boolean form. The response field is reasoning (not reasoning_content), which Marinara's extractReasoning() already checks.

Test script results (both formats work via nanogpt):

  • enable_thinking: true (non-stream): 4044 chars thinking ✓
  • thinking: {type:"enabled"} (non-stream): 1748 chars thinking ✓
  • enable_thinking: true (stream): 2225 chars thinking ✓
  • thinking: {type:"enabled"} (stream): 4549 chars thinking ✓

This affects all thinking-capable models via nanogpt, not just GLM. Any model where the user relies on the default "Maximum" reasoning effort will have thinking silently disabled.

  • I DID NOT read this template and provide the requested details.
Originally created by @xDanteMD on GitHub (Jul 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3498 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When using GLM models (from Zhipu/Z.ai) via the nanogpt provider, thinking/reasoning never activates — even when the user explicitly sets "Reasoning Effort: Maximum" in Advanced Parameters. The brain icon never appears. The root cause is a **client/server default mismatch**: the client defaults `reasoningEffort` to `"maximum"` while the server defaults it to `null`, causing the client to skip saving the parameter (it thinks it matches the default) and the server to receive `null` (thinking disabled). ## Expected behavior When a user sets Reasoning Effort to Maximum (or any non-null value) in Advanced Parameters, the model should produce reasoning/thinking output, and the brain icon should appear in the chat. ## Actual behavior The debug log shows: ``` EnableThinking: false ShowThoughts: true Effort: none ``` Despite the UI showing "Reasoning Effort: Maximum" toggled on. The thinking parameter is never sent to the API. ## Root cause analysis ### The mismatch | Layer | `reasoningEffort` default | Source | |-------|--------------------------|--------| | **Client** (UI) | `"maximum"` | `GenerationParametersEditor.tsx` lines 66, 82 | | **Server** (runtime) | `null` | `constants/defaults.ts` line 32 | ### How the bug manifests 1. User opens Advanced Parameters, sees "Reasoning Effort" set to "Maximum" (the client default) 2. User toggles it on / confirms Maximum — this matches the client default 3. Client's `setParameters()` in `AdvancedParametersSection.tsx` (line 126) compares each parameter against `defaults[key]`. Since `reasoningEffort: "maximum" === defaults.reasoningEffort: "maximum"`, the parameter is **NOT saved** to `chatParameters` 4. Server receives `chatMeta.chatParameters` without `reasoningEffort` 5. `parseStoredGenerationParameters()` returns `{ reasoningEffort: undefined }` (not in the stored object) 6. `resolveGenerationProviderRuntime()` applies chat params — but `undefined` doesn't trigger the override at line 94 (`if (params.reasoningEffort !== undefined)`) 7. `runtime.reasoningEffort` stays at the server default: `null` 8. `resolvedEffort` = `null`, `enableThinking` = `false` 9. `body.enable_thinking` is never set, or set to `false` — thinking is disabled ### Key code locations - **Client defaults**: `packages/client/src/components/ui/GenerationParametersEditor.tsx` lines 66, 82 — `reasoningEffort: "maximum"` - **Server defaults**: `packages/shared/src/constants/defaults.ts` line 32 — `reasoningEffort: null` - **Client skip logic**: `packages/client/src/features/chat-settings/sections/AdvancedParametersSection.tsx` line 126 — only saves if different from default - **Server override gate**: `packages/server/src/services/generation/provider-generation-runtime.ts` line 94 — only applies if `!== undefined` - **Resolved to null**: `packages/server/src/services/generation/provider-generation-runtime.ts` line 152 — `resolvedEffort = null` when reasoningEffort is null ## Steps to reproduce 1. Add a nanogpt connection with a valid API key 2. Select a GLM model (e.g., `glm-4.7`) 3. Open Advanced Parameters (chat settings gear icon) 4. Observe "Reasoning Effort" is already set to "Maximum" (the client default) 5. Toggle it on if needed, confirm Maximum is selected 6. Send a message 7. Open debug view — notice `EnableThinking: false` and `Effort: none` 8. No brain icon appears, no thinking content is produced ## Environment - Marinara Engine version: 2.1.1 - Install type: source (The installer, whatever that works out to) - OS + version: Windows 10 - Browser or app shell: Firefox ## Suggested fix **Option A (minimal, recommended):** Align the server default with the client default. In `packages/shared/src/constants/defaults.ts`, change line 32: ```typescript // Before: reasoningEffort: null, // After: reasoningEffort: "maximum", ``` This ensures that when the client skips saving `reasoningEffort` (because it matches the default), the server's fallback also defaults to `"maximum"`, and thinking is enabled. **Option B (more robust):** Always save `reasoningEffort` in the client regardless of whether it matches the default. In `AdvancedParametersSection.tsx`, remove the diff check for `reasoningEffort` specifically, or change the client default to `null` to match the server. Option A is the safest because it doesn't change client storage behavior and aligns with user expectations (Maximum is the sensible default for thinking-enabled models). ## Additional context **API format is NOT the issue.** Testing confirmed that nanogpt correctly handles `enable_thinking: true` and returns `reasoning` content. The Zhipu API documentation specifies `thinking: { type: "enabled" }` but nanogpt accepts the boolean form. The response field is `reasoning` (not `reasoning_content`), which Marinara's `extractReasoning()` already checks. **Test script results** (both formats work via nanogpt): - `enable_thinking: true` (non-stream): 4044 chars thinking ✓ - `thinking: {type:"enabled"}` (non-stream): 1748 chars thinking ✓ - `enable_thinking: true` (stream): 2225 chars thinking ✓ - `thinking: {type:"enabled"}` (stream): 4549 chars thinking ✓ **This affects all thinking-capable models via nanogpt**, not just GLM. Any model where the user relies on the default "Maximum" reasoning effort will have thinking silently disabled. - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:43:36 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@SpicyMarinara commented on GitHub (Jul 11, 2026):

Claimed for implementation by @SpicyMarinara in draft PR #3507.

<!-- gh-comment-id:4949121755 --> @SpicyMarinara commented on GitHub (Jul 11, 2026): Claimed for implementation by @SpicyMarinara in draft PR #3507.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 11, 2026):

Addressed in PR #3507, which is ready for review and has CodeRabbit requested.

<!-- gh-comment-id:4949217428 --> @SpicyMarinara commented on GitHub (Jul 11, 2026): Addressed in PR #3507, which is ready for review and has CodeRabbit requested.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1893
No description provided.