feat(providers): GLM-5.2 native reasoning_effort controls (port kilocode#11555) - #51108
Closed
teknium1 wants to merge 1 commit into
Closed
feat(providers): GLM-5.2 native reasoning_effort controls (port kilocode#11555)#51108teknium1 wants to merge 1 commit into
teknium1 wants to merge 1 commit into
Conversation
Port from Kilo-Org/kilocode#11555: GLM-5.2 exposes a native reasoning_effort knob with two enabled levels (high / max) on its OpenAI-compatible endpoints. Previously the zai profile (direct Z.AI /api/paas/v4) used the base ProviderProfile and emitted nothing, and the OpenCode Go profile only handled Kimi K2 / DeepSeek — so a user's effort preference for GLM-5.2 was silently dropped on both routes. - zai: ZaiProfile maps effort onto high/max (xhigh/max -> max, lower -> high) - opencode-go: same mapping for GLM-5.2, alongside existing Kimi/DeepSeek - alias spellings recognized (glm-5.2 / glm-5-2 / glm-5p2, vendor-prefixed) - disabled / no effort leaves the server default untouched
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-attribute |
2 |
unresolved-import |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
tests/plugins/model_providers/test_zai_profile.py:9: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
run_agent.py:2984: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
✅ Fixed issues (1):
| Rule | Count |
|---|---|
invalid-assignment |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
Unchanged: 6037 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Contributor
Author
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
GLM-5.2's reasoning effort preference now reaches the model on both Z.AI routes — previously it was silently dropped.
GLM-5.2 exposes a native
reasoning_effortknob with two enabled levels (high/max) on its OpenAI-compatible endpoints. Thezaiprofile (direct Z.AI/api/paas/v4) used the baseProviderProfileand emitted no reasoning controls at all, and the OpenCode Go profile only handled Kimi K2 / DeepSeek — so a user setting reasoning effort on GLM-5.2 had no effect on either route.Ported from Kilo-Org/kilocode#11555, adapted to hermes-agent's provider-profile architecture.
Changes
plugins/model-providers/zai/__init__.py: base profile →ZaiProfilewith GLM-5.2 effort mapping (xhigh/max→max; lower enabled levels →high; disabled/unset → server default).plugins/model-providers/opencode-zen/__init__.py: same GLM-5.2 mapping added toOpenCodeGoProfile, alongside the existing Kimi/DeepSeek branches.glm-5.2,glm-5-2,glm-5p2, and vendor-prefixed forms (z-ai/glm-5.2,accounts/fireworks/models/glm-5p2).test_zai_profile.py(18) + GLM-5.2 cases added totest_opencode_go_profile.py.Adaptation notes
Kilo Code maps three SDK shapes (
@openrouter/ai-sdk-provider→ high/xhigh,@ai-sdk/openai-compatible→ high/max,@ai-sdk/anthropic→ effort high/max). Hermes already passes the fullreasoning_configthrough to OpenRouter asextra_body.reasoning(xhigh handled there), so this PR only needs the two OpenAI-compatible direct routes hermes owns: Z.AI direct and OpenCode Go. GLM-5.2 on these routes has exactly two enabled effort levels per Z.AI/BigModel docs, so the richer Hermes scale clamps ontohigh/max.Validation
reasoning_effort: maxreasoning_effort: highreasoning_effort: max47 targeted tests pass. E2E verified through the real
ChatCompletionsTransport.build_kwargs()with real provider discovery against a tempHERMES_HOME— effort reaches the wire, noextra_bodypollution, non-target models and Kimi/DeepSeek paths unaffected.