fix: GLM 5.3 always-thinking (force-on) — fixes #162 - #166
Open
Fahad090NP wants to merge 5 commits into
Open
Conversation
GLM 5.3 and later reject thinking: { type: disabled } with 'This model always engages in thinking and cannot be disabled'. Detect 5.3+ by version and force thinking on (default high), mirroring the Kimi K2.7-code force-on fix. The picker now exposes only high/max and hides off.
…ani#162) The retry safety-net had no pattern for the GLM 5.3 error 'This model always engages in thinking and cannot be disabled'. Add a pattern that strips the thinking field so a stale disabled payload is recovered automatically (the model thinks by default).
Add cases for version detection (dot/hyphen/free/suffix variants), forced-on resolution even with a stale 'off' override, payload shape (reasoning_effort high/max), and picker schema exposing only high/max. Confirms glm-5.2/5.1/5 still allow disabled.
Assert analyzeHttp400ForRetry strips the thinking field for the GLM 5.3 'cannot be disabled' error and recovers.
Add a Fixed entry to CHANGELOG and a note in the per-model thinking controls doc describing the GLM 5.3+ force-on behavior. Also fix pre-existing MD049 underscore emphasis and prettier formatting in both files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #162 — GLM 5.3 (and later) rejects
thinking: { type: "disabled" }with HTTP 400:Changes
src/thinking/glm.ts—GlmThinkingnow detects GLM 5.3+ by version (/^glm-5[.\-](?:[3-9]|\d{2,})/i) and forces thinking on (defaulthigh). The model picker exposes onlyhigh/maxand hidesoff, mirroring the existing Kimi K2.7-code force-on behavior.normalize()upgrades any staleoffoverride tohighso cached settings can't trigger the 400.src/retry.ts— added a defensive recovery pattern: when the upstream reports it "cannot be disabled" / "always engages in thinking", thethinkingfield is stripped from the body so a retry succeeds instead of looping.src/test/thinking.test.ts(version detection, forced-on resolution, payload shape, picker schema) andsrc/test/retry.test.ts(cannot-be-disabled recovery).Verification
npm test— 333/333 passnpm run lint— all 7 gates pass (Editorconfig, ESLint, Markdown, Prettier, Shell, TypeScript, Tests)PEACE BE UPON YOU