Skip to content

opencode-go: DeepSeek V4 xhigh/max thinking levels not selectable #99617

Closed

Description

@34262315716

Problem

OpenClaw 的 thinking level 选择器对大部分模型只能显示 minimum ~ high 级别,xhigh 和 max 选项因为 getSupportedThinkingLevels() 的过滤逻辑不会被显示。

但 opencode-go 的 DeepSeek V4 (deepseek-v4-pro / deepseek-v4-flash) 实际通过 API 支持 reasoning_effort: "max",用户应当能选择到 xhigh/max 并发出对应的 reasoning_effort。

Root Cause

这是个双重问题,两个环节都需要修复才能让用户完整使用 reasoning 能力:

1. Catalog 缺少 thinkingLevelMap

extensions/opencode-go/provider-catalog.ts 中两个 DeepSeek V4 模型定义没有声明 thinkingLevelMap。getSupportedThinkingLevels() 依赖此字段来确定模型支持哪些 thinking level;没有声明时默认只有 minimum ~ high。

2. Stream wrapper 硬编码 reasoning_effort 映射

extensions/opencode-go/stream.ts 使用 createDeepSeekV4OpenAICompatibleThinkingWrapper,其内部用 resolveDeepSeekV4ReasoningEffort 硬编码了 reasoning_effort 映射,完全不读取模型的 thinkingLevelMap 配置。即使 catalog 声明了 map,wrapper 也不会使用它。

Fix

两个文件一起修:

  1. provider-catalog.ts: 为 deepseek-v4-pro 和 deepseek-v4-flash 新增 thinkingLevelMap,映射 minimal/low/medium → "high", high/xhigh/max → "max"

  2. stream.ts: 将硬编码的 createDeepSeekV4OpenAICompatibleThinkingWrapper 替换为内联的 streamWithPayloadPatch 逻辑,运行时读取 model.thinkingLevelMap 决定 reasoning_effort 值

Related

Activity

  1. clawsweeper commented on Jul 3, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 3, 2026, 2:31 PM ET / 18:31 UTC.

    Summary
    Keep open: current main and v2026.6.11 still lack the opencode-go DeepSeek V4 metadata needed to expose xhigh/max, and the linked closing PR is open and not merge-ready.

    Reproducibility: yes. by source inspection: current main lacks thinkingLevelMap for the two opencode-go DeepSeek V4 models, and getSupportedThinkingLevels hides xhigh/max when those entries are absent. I did not run a live opencode-go API request in this read-only review.

    Root-cause cluster
    Relationship: canonical
    Canonical: #99617
    Summary: This issue is the active canonical report because it has the open closing PR and describes both the catalog exposure gap and stream mapping concern.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    No separate repair job should start while the issue is already paired with the open closing PR at #99618.

    Review details

    Best possible solution:

    Land one focused opencode-go provider fix that exposes xhigh/max for DeepSeek V4, preserves the shared DeepSeek wrapper behavior, and includes focused tests plus real after-fix proof.

    Do we have a high-confidence way to reproduce the issue?

    Yes, by source inspection: current main lacks thinkingLevelMap for the two opencode-go DeepSeek V4 models, and getSupportedThinkingLevels hides xhigh/max when those entries are absent. I did not run a live opencode-go API request in this read-only review.

    Is this the best way to solve the issue?

    No, the issue is not solved yet. The best path is to review, repair, or replace the linked candidate PR so the provider catalog/profile and stream wrapper behavior agree without duplicating shared payload logic.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The exact external opencode-go API contract for the intended max/xhigh effort mapping still needs real or official proof before merging a payload-behavior change.
    • The open linked PR is conflicting and has review feedback, so the exact final implementation path is not settled yet.

    Codex review notes: model internal, reasoning high; reviewed against df1452799b28.

    Label changes

    Label justifications:

    • P2: This is a bounded provider/model capability bug affecting opencode-go DeepSeek V4 thinking-level selection and payload behavior.
    • impact:auth-provider: The issue concerns model/provider capability exposure and the reasoning payload sent through the provider runtime.
    Evidence reviewed

    What I checked:

    • Root policy read: Read the full root AGENTS.md; its provider/plugin boundary and review-depth guidance applies to this provider capability issue. (AGENTS.md:1, df1452799b28)
    • Scoped extension policy read: Read extensions/AGENTS.md; it keeps provider catalog/runtime behavior in the owning plugin while preferring shared provider-family helpers when they fit. (extensions/AGENTS.md:1, df1452799b28)
    • Current catalog lacks extended thinking map: Current main defines opencode-go deepseek-v4-pro and deepseek-v4-flash as reasoning models with supportsReasoningEffort but without thinkingLevelMap entries. (extensions/opencode-go/provider-catalog.ts:37, df1452799b28)
    • Level exposure requires map entries: getSupportedThinkingLevels filters out xhigh and max unless the selected model's thinkingLevelMap has a non-undefined entry for those levels. (src/llm/model-utils.ts:46, df1452799b28)
    • Current stream wrapper has fixed DeepSeek V4 mapping: The opencode-go wrapper delegates to createDeepSeekV4OpenAICompatibleThinkingWrapper, whose default resolver maps xhigh/max to max and all lower enabled levels to high rather than reading model.thinkingLevelMap. (src/plugin-sdk/provider-stream-shared.ts:481, df1452799b28)
    • Direct DeepSeek sibling profile exists: The direct DeepSeek provider exposes a provider thinking profile for V4 with off through max, which is the closest sibling pattern for the missing opencode-go exposure. (extensions/deepseek/thinking.ts:5, df1452799b28)

    Likely related people:

    • steipete: Added the OpenCode Go DeepSeek V4 model entries and later routed those models through the OpenAI transport and wrapper path. (role: feature-history owner; confidence: high; commits: 390be8138f28, afd6b5d6fce1, 66f84a9bf108; files: extensions/opencode-go/provider-catalog.ts, extensions/opencode-go/stream.ts)
    • zhangguiping-xydt: Authored recent opencode-go stream termination work that composes around the same createOpencodeGoWrapper path. (role: recent stream-wrapper contributor; confidence: medium; commits: 769579bcf0c2; files: extensions/opencode-go/stream.ts, extensions/opencode-go/stream-termination.ts)
    • vincentkoc: Recently changed shared provider reasoning payload normalization and opencode-go catalog helper code adjacent to the wrapper and catalog surfaces. (role: adjacent shared-helper contributor; confidence: medium; commits: 35bafea757fa, 66701d5a1e16; files: src/plugin-sdk/provider-stream-shared.ts, extensions/opencode-go/provider-catalog.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P2
    impact:auth-provider
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    on Jul 3, 2026
  3. 34262315716 commented on Jul 4, 2026

    @34262315716
    Author

    A new PR has been submitted that replaces #99618 with a cleaner approach:

    PR #99882 — fix(opencode-go): register thinking profile to enable xhigh/max support

    Instead of adding thinkingLevelMap to model entries (which only affected stream wrapping, not the UI), this PR:

    1. Adds a resolveThinkingProfile hook (new thinking.ts), exposing the full off~max level range
    2. Keeps the existing shared stream wrapper unchanged — it already maps thinking levels to reasoning_effort correctly

    API verification has been done against the opencode-go endpoint confirming that reasoning_effort: "max", "high", and disabled thinking all work as expected.

    PR #99618 is superseded and will not be pursued further.

  4. 34262315716 commented on Jul 4, 2026

    @34262315716
    Author

    Closing — PR #99643 by mushuiyu886 provides a complete fix for this issue with:

    • thinkingLevelMap + resolveThinkingProfile in provider-catalog.ts
    • Manifest JSON metadata (openclaw.plugin.json)
    • Comprehensive test coverage (clampThinkingLevel, profile, payload mapping, manifest)
    • Real behavior proof with captured HTTP payloads

    Our PR #99882 is withdrawn in favor of #99643.

  5. 34262315716 commented on Jul 4, 2026

    @34262315716
    Author

    Closing — PR #99643 by mushuiyu886 provides a complete fix. Our PR #99882 is withdrawn in favor of #99643.

  6. steipete commented on Jul 29, 2026

    @steipete
    Contributor

    Thank you for the detailed report and for confirming that #99643 resolves this. The fix is already merged into main as a97d97f.

    I verified both OpenCode Go DeepSeek V4 model entries, the cold-start thinking profile and manifest, and the real outgoing reasoning payload: xhigh and max are selectable and both send reasoning_effort: "max"; existing lower levels and disabled thinking are preserved. The current regression suites pass all 36 focused tests, including both models and the Gateway provider-policy artifact.

    Closing as completed, as you requested. The broader OpenCode catalog-discovery follow-up in #113549 remains open.

  7. locked as resolved and limited conversation to collaborators on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:auth-providerissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions