feat(opencode-go): support GLM-5 reasoning controls (#49279) - #50694
feat(opencode-go): support GLM-5 reasoning controls (#49279)#50694izumi0uu wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the missing provider-profile path and adding transport-level coverage.
Problems
- Current main now has a GLM-5.2-specific OpenCode Go implementation at
plugins/model-providers/opencode-zen/__init__.py:64-77; it emits only native top-levelreasoning_effortand intentionally leaves disabled/unset requests at server defaults. - Current regression coverage explicitly requires
glm-5.1andglm-5to emit no OpenCode Go reasoning controls (tests/plugins/model_providers/test_opencode_go_profile.py:185-201). The proposedstartswith("glm-5")gate changes that contract by applying the DeepSeek wire shape. - The linked issue's only comment says the GLM-5.x relay contract was not verified, including whether it accepts top-level
reasoning_effortor requires another format.
Suggested changes
- Verify the OpenCode Go GLM-5.1 relay contract, then add a narrowly scoped GLM-5.1 branch and tests for enabled, disabled, and unset behavior without changing the existing GLM-5.2 contract.
Automated hermes-sweeper review.
| return extra_body, top_level | ||
|
|
||
| if not _is_deepseek_thinking_model(model): | ||
| if not ( |
There was a problem hiding this comment.
This broad glm-5* gate applies DeepSeek's thinking/reasoning_effort contract to GLM-5.1, but the linked issue says the relay contract is unverified. Current main instead scopes native controls to GLM-5.2 and explicitly tests glm-5.1 as non-target; please verify and encode the exact GLM-5.1 wire contract before widening this gate.
|
Thanks for the review. I verified the OpenCode Go contract instead of carrying over the DeepSeek mapping. The official metadata marks GLM-5.1 as reasoning-capable but exposes no configurable GLM-5.2 is the supported exception, and its |
What does this PR do?
Adds GLM-5 reasoning support to the
opencode-goprofile so Hermes stops silently dropping/reasoningfor GLM-5 model IDs routed throughplugins/model-providers/opencode-zen/__init__.py.Before this change,
OpenCodeGoProfile.build_api_kwargs_extras()only applied reasoning controls to Kimi K2 and DeepSeek thinking models.glm-5*IDs fell through the gate entirely, so/reasoning high,/reasoning off, and related settings had no effect on GLM-5 requests on this provider path.This PR adds a GLM-5 model gate and reuses the existing DeepSeek-style mapping already used on OpenCode Go:
reasoning_effortextra_body.thinking={"type":"disabled"}extra_body.thinking={"type":"enabled"}Related Issue
Fixes #49279
Type of Change
Changes Made
_is_glm_thinking_model()toplugins/model-providers/opencode-zen/__init__.pytests/plugins/model_providers/test_opencode_go_profile.pyglm-4.5andglm-4.5-flashexcludedreasoning_effortreaches final kwargs for GLM-5How to Test
main, callOpenCodeGoProfile.build_api_kwargs_extras(..., model="glm-5.1")with a reasoning config and observe that it returns no GLM reasoning controls../.venv/bin/python -m pytest tests/plugins/model_providers/test_opencode_go_profile.py -qgit diff --checkChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Targeted validation run: