Skip to content

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

Closed
34262315716 wants to merge 1 commit into
openclaw:mainfrom
34262315716:fix/opencode-go-thinking-profile
Closed

34262315716 wants to merge 1 commit into
openclaw:mainfrom
34262315716:fix/opencode-go-thinking-profile

Conversation

@34262315716

Copy link
Copy Markdown

Summary

Fixes: #99617

Problem

Opencode-go DeepSeek V4 models (deepseek-v4-pro, deepseek-v4-flash) have supportsReasoningEffort: true but lack a resolveThinkingProfile hook. Without one, the gateway falls back to the base thinking profile (off~high), so xhigh and max never appear in the UI even though the stream wrapper (createDeepSeekV4OpenAICompatibleThinkingWrapper) already handles them correctly on the wire.

PR #99618 attempted to fix this by adding thinkingLevelMap to the model entries, but that approach has two problems:

  1. thinkingLevelMap only affects the stream wrapper — it does not influence resolveThinkingProfile(), so the UI/gateway still filters out xhigh/max.
  2. It mapped high → "max", silently changing existing /think high behavior from reasoning_effort: "high" to "max", which affects cost and latency.

Changes

  • extensions/opencode-go/thinking.ts (new) — Define a thinking profile identical to the deepseek extensions pattern, exposing the full level range: off, minimal, low, medium, high, xhigh, max with defaultLevel: "high".
  • extensions/opencode-go/index.ts (+3 lines) — Register resolveThinkingProfile hook pointing at the new profile.
  • stream.ts / provider-catalog.ts — Unchanged. The shared createDeepSeekV4OpenAICompatibleThinkingWrapper already maps thinking levels to reasoning_effort correctly.

Real API Verification

All three tests conducted against https://opencode.ai/zen/go/v1 with deepseek-v4-pro:

Test 1: reasoning_effort: "max"

curl -s -X POST https://opencode.ai/zen/go/v1/chat/completions \
  -H "Authorization: Bearer $OPENCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"请用中文思考 1+1=?给出推理过程"}],"reasoning_effort":"max","max_tokens":500}'

Result: HTTP 200 ✅ — Response contains reasoning_content (134 reasoning tokens), full chain-of-thought reasoning in Chinese.

Test 2: reasoning_effort: "high"

curl -s -X POST https://opencode.ai/zen/go/v1/chat/completions \
  -H "Authorization: Bearer $OPENCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"请用中文回答 2+2=?"}],"reasoning_effort":"high","max_tokens":500}'

Result: HTTP 200 ✅ — Contains reasoning_content (119 reasoning tokens), shorter than "max" as expected.

Test 3: thinking disabled

curl -s -X POST https://opencode.ai/zen/go/v1/chat/completions \
  -H "Authorization: Bearer $OPENCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"请用中文回答 3+3=?"}],"thinking":{"type":"disabled"},"max_tokens":500}'

Result: HTTP 200 ✅ — No reasoning_content, direct 6-token answer, reasoning fully disabled.

Verification

  • TypeScript type check: npx tsc -p extensions/opencode-go/tsconfig.json --noEmit
  • Backward compatible: non-DeepSeek-V4 models unaffected; models without thinking profile continue using base profile

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 4:21 AM ET / 08:21 UTC.

Summary
The PR adds an opencode-go DeepSeek V4 thinking profile and registers it through the provider's resolveThinkingProfile hook.

PR surface: Source +28. Total +28 across 2 files.

Reproducibility: yes. Source inspection shows current main has the opencode-go DeepSeek V4 models and shared stream wrapper but no opencode-go provider thinking profile hook, so user-facing profile resolution falls back to the base level set.

Review metrics: 1 noteworthy metric.

  • Provider thinking profile surface: 1 profile added, 1 hook added, 0 tests added. The change is narrowly shaped, but the absence of focused tests matters because a clean sibling already proves the same provider capability path.

Root-cause cluster
Relationship: same_root_cause
Canonical: #99643
Summary: This PR and the canonical sibling target the same opencode-go DeepSeek V4 thinking-level profile gap; the sibling is the stronger currently viable landing path, but this PR is kept open for maintainer choice because the paired same-author issue remains open.

Members:

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

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] If this branch remains a candidate, add OpenClaw-path proof for profile resolution, Gateway thinking metadata/PATCH, and the outbound DeepSeek V4 payload.
  • [P1] Add focused opencode-go tests matching the direct DeepSeek V4 profile-hook coverage.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes live opencode-go API result summaries, but it does not show after-fix OpenClaw profile, Gateway metadata/PATCH, or outbound wrapper behavior; the sibling branch has that stronger proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging this PR instead of the open proof-positive sibling would leave out focused regression coverage and manifest/runtime metadata that already exist in fix(opencode-go): expose DeepSeek V4 max thinking levels #99643.
  • [P1] Provider thinking metadata changes what opencode-go DeepSeek V4 sessions can select, persist, and display, so maintainers should intentionally choose one canonical branch before merge.
  • [P1] This PR's API proof checks raw opencode-go API behavior, but it does not show the full OpenClaw profile, Gateway row/PATCH, or outbound payload path after the patch.

Maintainer options:

  1. Use the proof-positive canonical branch (recommended)
    Prefer the clean sibling branch that includes provider-profile wiring, tests, manifest/runtime metadata, and sufficient real-behavior proof, then close duplicate branches after the canonical path is chosen or merged.
  2. Bring this branch to parity first
    If maintainers prefer this smaller branch, add the sibling's OpenClaw-path proof, focused tests, and metadata alignment before considering merge.
  3. Accept the smaller hook-only change
    Maintainers could accept this branch as a minimal fix, but that leaves the tests and metadata coverage already present in the sibling branch behind.

Next step before merge

  • [P1] Maintainers need to choose the canonical branch for this same-root provider fix; automation should not repair or merge this smaller branch while a stronger clean sibling exists.

Security
Cleared: No concrete security or supply-chain concern is visible; this PR adds provider-local TypeScript profile wiring without dependencies, workflows, downloads, or secret handling.

Review details

Best possible solution:

Land one canonical opencode-go DeepSeek V4 provider-profile fix, preferably the proof-positive sibling branch, while keeping the shared DeepSeek V4 wrapper as the wire-contract source.

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

Yes. Source inspection shows current main has the opencode-go DeepSeek V4 models and shared stream wrapper but no opencode-go provider thinking profile hook, so user-facing profile resolution falls back to the base level set.

Is this the best way to solve the issue?

No, not as the best landing path while the sibling remains viable. This PR uses the right hook shape, but #99643 covers the same root fix with stronger proof, tests, and metadata alignment.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: Provider thinking metadata controls which levels existing opencode-go DeepSeek V4 sessions can select, persist, and see after upgrade.
  • add merge-risk: 🚨 auth-provider: The PR changes provider/model capability routing for opencode-go DeepSeek V4 and the reasoning controls sent through that provider runtime.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes live opencode-go API result summaries, but it does not show after-fix OpenClaw profile, Gateway metadata/PATCH, or outbound wrapper behavior; the sibling branch has that stronger proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded provider capability bugfix for opencode-go DeepSeek V4 thinking-level selection.
  • merge-risk: 🚨 compatibility: Provider thinking metadata controls which levels existing opencode-go DeepSeek V4 sessions can select, persist, and see after upgrade.
  • merge-risk: 🚨 auth-provider: The PR changes provider/model capability routing for opencode-go DeepSeek V4 and the reasoning controls sent through that provider runtime.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes live opencode-go API result summaries, but it does not show after-fix OpenClaw profile, Gateway metadata/PATCH, or outbound wrapper behavior; the sibling branch has that stronger proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +28. Total +28 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 28 0 +28
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 28 0 +28

What I checked:

  • Root and scoped policy applied: Root AGENTS.md and extensions/AGENTS.md were read; the relevant guidance is to review provider/plugin boundaries deeply and keep provider-owned behavior in the owning plugin while reusing shared helpers. (extensions/AGENTS.md:1, 55d0d037bfde)
  • Current main lacks opencode-go thinking profile hook: Current main registers opencode-go catalog augmentation and the shared stream wrapper but has no resolveThinkingProfile hook, so opencode-go DeepSeek V4 falls back to the base thinking profile. (extensions/opencode-go/index.ts:137, 55d0d037bfde)
  • Current main keeps DeepSeek V4 wire mapping in shared wrapper: The current opencode-go stream path already delegates DeepSeek V4 payload handling to createDeepSeekV4OpenAICompatibleThinkingWrapper, so the narrower owner-boundary fix is profile exposure rather than rewriting stream mapping. (extensions/opencode-go/stream.ts:23, 55d0d037bfde)
  • Current profile resolver consumes provider hooks: User-facing thinking profile resolution asks provider hooks before falling back to the base profile, and passes the selected model id to the provider context. (src/auto-reply/thinking.ts:181, 55d0d037bfde)
  • Direct DeepSeek sibling pattern: The direct DeepSeek plugin exposes the same off-through-max V4 profile and registers it through resolveThinkingProfile, matching the shape this PR adopts for opencode-go. (extensions/deepseek/thinking.ts:5, 55d0d037bfde)
  • PR diff adds the profile hook only: This PR adds extensions/opencode-go/thinking.ts and wires it into extensions/opencode-go/index.ts, but it does not add the sibling PR's focused tests or manifest metadata updates. (extensions/opencode-go/thinking.ts:3, 30829ecbb32e)

Likely related people:

  • steipete: Added the opencode-go DeepSeek V4 model rows and routed those models through the OpenAI transport/wrapper path this PR relies on. (role: recent opencode-go DeepSeek V4 behavior contributor; confidence: high; commits: 390be8138f28, afd6b5d6fce1; files: extensions/opencode-go/provider-catalog.ts, extensions/opencode-go/stream.ts)
  • ImLukeF: Authored the merged OpenCode Go provider support PR that introduced the provider/model routing surface later used by this bug. (role: introduced provider surface; confidence: medium; commits: 7761e7626ffe; files: extensions/opencode-go/index.ts, extensions/opencode-go/provider-catalog.ts, docs/providers/opencode-go.md)
  • vincentkoc: Merged the original OpenCode Go provider PR and later authored shared provider reasoning payload normalization near the stream-helper boundary. (role: merger and adjacent shared-helper contributor; confidence: medium; commits: 35bafea757fa, d809eb17d509; files: src/plugin-sdk/provider-stream-shared.ts, extensions/opencode-go/index.ts, extensions/opencode-go/provider-catalog.ts)
  • ai-hpc: Authored the direct DeepSeek V4 max thinking-profile fix, the closest sibling pattern for this opencode-go profile hook. (role: adjacent thinking-profile contributor; confidence: medium; commits: 007023e8a4bd; files: extensions/deepseek/index.ts, extensions/deepseek/thinking.ts, extensions/deepseek/index.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 4, 2026
Add resolveThinkingProfile hook for opencode-go DeepSeek V4 models,
exposing the full thinking level range (off~max). The stream wrapper
already handles reasoning_effort mapping correctly via the shared
createDeepSeekV4OpenAICompatibleThinkingWrapper; this change only
fixes the UI/gateway display so xhigh and max become selectable.

API verification results (against opencode.ai/zen/go/v1):
- reasoning_effort: max  -> 200 + reasoning_content (134 tokens)
- reasoning_effort: high -> 200 + reasoning_content (119 tokens)
- thinking: disabled     -> 200 + direct answer (no reasoning)
@34262315716
34262315716 force-pushed the fix/opencode-go-thinking-profile branch from 0be88f6 to 30829ec Compare July 4, 2026 08:12
@34262315716

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 4, 2026
@34262315716

Copy link
Copy Markdown
Author

Withdrawn — PR #99643 by mushuiyu886 provides a more complete fix with thinkingLevelMap, manifest metadata, tests, and real behavior proof.

@34262315716 34262315716 closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: opencode-go merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant