Skip to content

fix(provider): send DeepSeek reasoning_effort and add a per-model override - #1847

Closed
zszz3 wants to merge 3 commits into
vastsa:mainfrom
zszz3:fix/1821-deepseek-reasoning-effort
Closed

zszz3 wants to merge 3 commits into
vastsa:mainfrom
zszz3:fix/1821-deepseek-reasoning-effort

Conversation

@zszz3

@zszz3 zszz3 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1821: on Chat Completions, every DeepSeek-family model row had supportsReasoningEffort: false forced (added in #1701 for the #1664 relay 400). That covered the official endpoint too, and it left custom gateways with no way to opt back in. So low, high, and max produced byte-identical request bodies, and the selected thinking level never reached the wire.

Three commits:

  1. fix(provider): Official deepseek.com rows no longer suppress the field. pi-ai sends reasoning_effort next to thinking: {type: "enabled"}, as DeepSeek documents. Relay rows keep the [Bug] DeepSeek 模型下发上游不支持的 reasoning_effort(supportsReasoningEffort 排除列表漏配,所有 DeepSeek 中转渠道均受影响) #1664 suppression by default.
  2. feat(provider): Adds an optional per-model reasoningEffort (send | omit) on ModelBinding. Absent means automatic, which is the rule from commit 1. The explicit value wins over the automatic rule in both directions. It is carried through shared types, provider sync, model-config import, host-core persistence and normalization, the agent runtime, and provider copy. In Settings → Models, model Advanced settings shows a "Reasoning effort field" select (Automatic / Send / Omit), only for the Chat Completions API style, with a help tooltip. i18n is added for all locales.
  3. fix(settings): The new select made the thinking-control row too wide, so its labels overlapped. The row now wraps instead of overlapping.

No database migration. The new field is optional, and existing rows behave exactly as before unless they are official DeepSeek rows. Specs updated: 03-runtime/11-provider-model-system.md, 12-provider-config-schema.md, E2E-005E, and decisions D672/D673 (en + zh-CN).

Task candidate validation

  • Candidate: de087934f, base main 3f374a800. Rebased onto the latest main before validation.
  • Shared: typecheck passed, 1304 passed.
  • Agent runtime: typecheck passed. provider-binding and model-capabilities: 77 passed. These include captured-request tests showing that official auto sends the effort, relay auto omits it, relay Send sends it, and official Omit omits it.
  • Desktop: typecheck passed. Model advanced capabilities, provider copy, and remote provider sync: 27 passed.
  • host-core providers tests: 64 passed, including the round trip and normalization of reasoningEffort.
  • Biome lint, docs locale/doc checks, and git diff --check passed.
  • Desktop E2E (real Electron, host-core SQLite, and agent sidecar), with real DeepSeek requests through a local recording proxy:
    1. Created a relay-style provider (localhost URL) and an official-style provider (api.deepseek.com.localhost).
    2. Sent prompts at high: relay auto carried no reasoning_effort; official auto carried reasoning_effort: "high".
    3. In the Settings UI, set Relay → Send and Official → Omit, saved, and verified both values through providers/list.
    4. Restarted the app and prompted again: relay sent high, then low; official sent no reasoning_effort.
    5. All 5 upstream responses returned 200, for 12 checks in total.
  • The thinking-row layout was screenshot-checked at 1400, 1100, and 900 px window widths.
  • test:e2e:provider-api-style passed.

Known pre-existing failure, not caused by this PR: test:e2e:provider-model-layout fails with .provider-chosen-list: list cannot display even one complete row (height=13) at 1000×560. It fails the same way on e7d87652a and with this PR's UI changes reverted. Bisect points to 934bbc6 (the "No API key required" toggle, #1626), which added height to the connection section.

Environment: macOS, Electron 43.6.0. The host environment was reused, and profiles and data dirs were isolated in scratch. Not run: the full desktop suite (OOM in this environment), Linux/Windows (left to CI), and verify:ui:*.

fixes #1821

zszz3 added 3 commits October 23, 2026 21:09
PR vastsa#1701 forced supportsReasoningEffort off for every DeepSeek-family
Completions row. Official deepseek.com endpoints document
reasoning_effort (low/high/max) next to thinking, so their requests
carried only the thinking toggle and every non-off level produced the
same request.

Keep the suppression for relays, where vastsa#1664 reported the field being
rejected, and leave official rows to pi-ai's URL detection. Recorded as
D671 amending D389.

refs vastsa#1821
The endpoint rule cannot tell a DeepSeek-family relay that needs
reasoning_effort to honor High thinking (vastsa#1821) from one that rejects
the field (vastsa#1664). The user who configured the gateway is the only
reliable source, so a model binding can now pin the field with
reasoningEffort: "send" | "omit".

Absent keeps the automatic rule, so existing rows are unchanged. The
explicit value is applied after every automatic Completions compat
overlay. Host-core persists the key and drops unknown values; Settings
shows the selector only for Chat Completions rows.

refs vastsa#1821
Adding the reasoning effort selector made the thinking row's control
group wider than the model settings pane. The grid kept the controls on
one line beside the "Thinking levels" label, so the label overlapped
the thinking protocol label and the selects truncated to one letter.

The row now wraps: the label keeps its own line when the controls do
not fit, and the control group wraps onto further lines, right-aligned.
The narrow-window override that forced the same stacking through grid
placement is reduced to the one rule flex still needs.

refs vastsa#1821

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough request-body coverage. The custom-gateway defect in #1821 is real and is now fixed by #1846, which has merged while preserving the existing automatic compatibility defaults. This PR also changes deepseekRequestCompat so official DeepSeek endpoints start sending reasoning_effort automatically, and includes a separate settings-row layout adjustment. Those are additional behavior changes not required for the reported custom-gateway opt-in; the official default change alters existing requests and needs its own compatibility evidence and decision. I’m closing this PR as superseded by #1846. If you want to pursue the official-endpoint default separately, please propose it as a focused fix with its own report and evidence. Thanks for the work.

@vastsa vastsa closed this Oct 23, 2026
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.

[Bug] 自定义 DeepSeek 网关的 Chat Completions 静默丢失 High 思考参数(#1701 兼容规则缺少覆盖选项)

2 participants