Skip to content

fix(providers): stop silently dropping reasoning effort on opencode families (#10788) - #11409

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
oyi77:fix/reasoning-effort-opencode-ollama-nvidia
Aug 25, 2026
Merged

fix(providers): stop silently dropping reasoning effort on opencode families (#10788)#11409
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
oyi77:fix/reasoning-effort-opencode-ollama-nvidia

Conversation

@oyi77

@oyi77 oyi77 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses the code facets of #10788 (part 1). Ollama Cloud tier declarations already landed upstream in #11307; this covers what is still missing on release/v3.8.51 for opencode / opencode-go / opencode-zen and documents nvidia.

Dispatch — the silent drop

OpencodeExecutor.transformRequest stripped the effort-suffixed alias (e.g. glm-5.2-high) down to the base id and injected a flat reasoning_effort body field. But opencode-go's ChatCompletionRequest has no such field for non-DeepSeek families (its reasoning is a structured object), so the tier never reached the upstream — every request ran at default effort with no error.

Fix:

  • DeepSeek V4 keeps the base-rewrite + reasoning_effort injection — that IS its native contract via opencode-go (feat(opencode): add go deepseek reasoning variants #4647, sanitizer whitelist)
  • Every other family now forwards the aliased model id verbatim. The suffix is their only native effort mechanism (exactly the ids opencode models opencode-go --verbose lists), so the tier finally reaches the upstream

Registry — tiers invisible in the catalog

Declared supportedThinkingEfforts on base rows that had aliases but no tier vocabulary:

Registry Models declared
opencode-go glm-5.2 [high,max], mimo-v2.5 [high,max], grok-4.5 [low,medium,high], hy3 [none,low,high], kimi-k3 [max], qwen3.7-max/plus [high,max]
shared zen/go row qwen3.6-plus [high,max]
opencode-zen deepseek-v4-pro/flash [none,low,high,max], glm-5.2 [high,max], kimi-k3 [max]

This lets catalog variant synthesis (#9485) and sanitizeReasoningEffortForProvider clamping work from one source of truth matching the executor's EFFORT_TIERS.

nvidia — honest empty declaration

nvidia/z-ai/glm-5.2 is now marked reasoning-capable with an empty tier list: its upstream only exposes a binary chat_template_kwargs.enable_thinking switch (mapNvidiaGlm52ReasoningParams), so there are no honest -low/-high/-max tiers to advertise. Synthesizing fake variants would trade one bug for another; the empty list suppresses them while keeping the reasoning flag accurate.

Tests changed/added

  • opencode-go-effort-aliases-8353.test.ts: transform samples updated — non-DeepSeek aliases must reach the wire untouched with NO injected flat field; new registry-parity test asserting every base row's vocabulary equals EFFORT_TIERS; nvidia binary-switch declaration test
  • opencode-go-effort-aliases-6922.test.ts: glm/mimo transform expectations updated to alias-forwarding
  • DeepSeek paths (feat(opencode): add go deepseek reasoning variants #4647 tests, clobber guard) unchanged and still green

Verification

opencode/nvidia/deepseek effort suites (8 files): 191/191 pass
tsc --noEmit: no errors in changed files

Base: release/v3.8.51 (3192eb88d). Release-engineering facet of #10788 (npm publish flow) is out of scope here.

…amilies (diegosouzapw#10788)

Dispatch: OpencodeExecutor.transformRequest stripped the effort-suffixed
alias (e.g. glm-5.2-high) down to the base id and injected a flat
reasoning_effort body field — but opencode-go's ChatCompletionRequest has
no such field for non-DeepSeek families, so the tier never reached the
upstream and every request ran at default effort. Only DeepSeek V4
accepts the flat field (its native contract, diegosouzapw#4647), so it keeps the old
rewrite; every other family now forwards the aliased model id verbatim,
which is their only native effort mechanism.

Registry: declare supportedThinkingEfforts on the base rows that had
aliases but no tier vocabulary — opencode-go (glm-5.2, mimo-v2.5,
grok-4.5, hy3, kimi-k3, qwen3.7-max/plus), the shared zen/go row
(qwen3.6-plus) and opencode-zen (deepseek-v4-pro/flash, glm-5.2,
kimi-k3) — so catalog variant synthesis (diegosouzapw#9485) and
sanitizeReasoningEffortForProvider clamp from one source of truth.
nvidia z-ai/glm-5.2 is declared reasoning-capable with an EMPTY tier
list: its upstream only exposes a binary enable_thinking switch
(mapNvidiaGlm52ReasoningParams), so no honest tiers exist to advertise.

Ollama Cloud declarations were already landed upstream (diegosouzapw#11307); this
change covers the remaining providers named in diegosouzapw#10788.
@oyi77
oyi77 requested a review from diegosouzapw as a code owner August 24, 2026 15:08
@oyi77

oyi77 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

CI triage

Check Verdict Evidence
Fast Quality Gates / No new ESLint warnings Pre-existing on the base branch run-eslint-json --max-warnings 0 exits 2 with "suppressions left that do not occur anymore" — reproduced verbatim on a stashed clean release/v3.8.51 checkout (22 baseline problems). The currently-green PRs all target release/v3.8.50, whose suppression state differs. None of the flagged surface is touched by this PR (registry declarations + one executor transform).
Unit Tests fast-path (4/4) Under investigation → likely flake Same class of single-test flakes as documented on #11408 (tmp-dir rmSync ENOTEMPTY race and jitter-timing assertions in files this PR does not touch). Both pass locally on this branch.
dast-smoke Does not reproduce from this diff The fuzz 500s target DELETE /api/keys/{id}, OPTIONS /api/keys, OPTIONS /api/auth/logout — probed locally against a server built from the lazy-executor sibling branch: 204/401/204, all documented statuses.

No code changes required; will act on any maintainer findings.

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks — the DeepSeek-vs-rest split and the registry-parity test are exactly right, and we reproduced the silent-drop bug on the current tip. One blocker before merge: your new supportedThinkingEfforts declarations activate the nearest-tier clamp from #11295/#11305, so a Codex request asking effort=low on opencode-go/glm-5.2 is now rewritten to high — 'Codex Responses routing keeps reasoning effort while dropping GPT-only verbosity' fails on this branch but passes on the base tip (reproduced locally; it is also why Unit Tests 4/4 is red). Please either update that guard expectation deliberately (with a note on what the upstream actually accepts) or scope the declarations so lower requested efforts survive. The ESLint/quality-gate reds are inherited base-red and not your problem.

…arest-tier clamp

glm-5.2 on opencode-go now declares its live tier vocabulary {high, max},
so the declared-capability clamp maps out-of-vocabulary reasoning_effort
low to the nearest tier high. The verbosity-strip assertion is unchanged.
@oyi77

oyi77 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Nearest-tier clamp fix pushed (63ea2ed1f): the Codex-reroute characterization now locks the #10788 behavior — glm-5.2 declares {high, max} on opencode-go, so out-of-vocab low clamps up to high while GPT-only verbosity is still stripped. The fixed test passes in Unit Tests fast-path (3/4).

Heads-up on the current red batch (Docs Gates, all 4 unit shards, Vitest): these reproduce at pure upstream tip 6435f618f with none of this branch's content — e.g. tests/unit/agent-card-route.test.ts fails 0/5 and tests/unit/providers-constants-split.test.ts (231 APIKEY_PROVIDERS entries) fails at the tip itself, and check:docs-counts reports README/AGENTS/llm.txt still saying "159 migrations" while code has 160 after today's quota-share merge (#11408). They hit any PR merging against the current tip.

@diegosouzapw
diegosouzapw merged commit 8a8d0cf into diegosouzapw:release/v3.8.51 Aug 25, 2026
7 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants