Skip to content

fix(agents): suppress DeepSeek thinking for Foundry aliases - #87933

Merged
steipete merged 4 commits into
openclaw:mainfrom
MukundaKatta:fix/deepseek-v4-thinking-format-87737
Jun 7, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
MukundaKatta:fix/deepseek-v4-thinking-format-87737

Conversation

@MukundaKatta

@MukundaKatta MukundaKatta commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Treat microsoft-foundry-* DeepSeek V4 provider ids as Microsoft Foundry-compatible for the embedded runner DeepSeek fallback, so alias-backed Foundry deployments no longer receive the DeepSeek-native top-level thinking parameter.
  • Keep unowned OpenAI-compatible DeepSeek V4 proxy routes on the native DeepSeek fallback path.
  • Preserve explicit non-DeepSeek compat.thinkingFormat routes while stripping DeepSeek-native replay fields (reasoning_content) that OpenAI/Azure-style deployments can reject.

Fixes #90520.

Verification

  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts src/agents/embedded-agent-runner-extraparams.test.ts (139 tests passed)
  • pnpm exec oxfmt --check src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts
  • git diff --check
  • ./.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> autoreview clean: no accepted/actionable findings reported

Real behavior proof

Behavior addressed: Microsoft Foundry DeepSeek V4 alias providers no longer receive DeepSeek-native top-level thinking or replayed reasoning_content fields that Foundry rejects.

Real environment tested: Local OpenClaw checkout with the real CLI/gateway path until provider dispatch, plus issue #90520 reporter's live Foundry A/B provider proof for the same deployment/model alias behavior.

Exact steps or command run after this patch: I checked 1Password Molty metadata for a Foundry credential, then ran pnpm openclaw infer model run --gateway --model microsoft-foundry-9433/DeepSeek-V4-Pro --prompt 'Reply with exactly FOUNDRY_V4_PRO_OK and nothing else.' --json from this branch.

Evidence after fix: The local gateway probe produced real terminal output from OpenClaw and failed before provider dispatch with GatewayClientRequestError: Error: Model override "microsoft-foundry-9433/DeepSeek-V4-Pro" is not allowed for agent "main". The reporter's issue #90520 live proof shows microsoft-foundry/DeepSeek-V4-Pro succeeds while microsoft-foundry-9433/DeepSeek-V4-Pro fails with 400 Unrecognized request argument supplied: thinking; this patch removes that aliased thinking injection path and strips DeepSeek replay fields on the same alias-provider route.

Observed result after fix: Focused embedded-runner tests confirm the alias request payload no longer includes top-level thinking, no longer includes reasoning_effort, and strips assistant-message reasoning_content; native DeepSeek-compatible proxy routes still keep the DeepSeek-native fallback, and OpenRouter/Together-style reasoning controls remain preserved.

What was not tested: A complete live Microsoft Foundry round trip from my machine was not tested because no Foundry credential item was available and the local agent config rejected the alias model override before provider dispatch.

Notes

  • This PR intentionally does not edit CHANGELOG.md; release generation owns changelog entries.
  • The branch was rebased on current main and refreshed by a maintainer because the original PR predated the canonical Foundry fix and did not cover alias providers.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: S labels May 29, 2026
@clawsweeper

clawsweeper Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 3:49 AM ET / 07:49 UTC.

Summary
The PR gates the generic DeepSeek V4 OpenAI-compatible thinking wrapper on model.compat.thinkingFormat, adds targeted wrapper tests, and adds a CHANGELOG.md entry.

PR surface: Source +16, Tests +59, Docs +1. Total +76 across 3 files.

Reproducibility: yes. Current main has a high-confidence source reproduction: matching DeepSeek V4 OpenAI-compatible ids reach the generic fallback, which injects native thinking without consulting compat.thinkingFormat.

Review metrics: 1 noteworthy metric.

  • Release-owned changelog edit: 1 added. Normal PRs should keep release-note context in the PR body or squash message because release generation owns CHANGELOG.md.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted real behavior proof from a gateway/provider run, terminal output, logs, recording, or linked artifact; redact IPs, API keys, phone numbers, non-public endpoints, and other private details.
  • Remove the CHANGELOG.md entry and keep the release-note context in the PR body or eventual squash message.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides red/green unit-test output only; it still needs redacted real gateway/provider output, terminal output, logs, recording, linked artifact, or explicit maintainer proof override before merge. 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] External contributor proof is still source/unit-test output only; before merge this needs redacted real gateway/provider output or an explicit maintainer proof override.
  • [P1] The branch edits release-owned CHANGELOG.md; that line should be removed while preserving release-note context in the PR body or squash message.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow compat gate and regression tests after real gateway/provider proof or a maintainer proof override is recorded, with the changelog line removed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Maintainer review is needed because external real behavior proof or a maintainer proof override must come from a real environment, and the changelog cleanup should be handled before merge.

Security
Cleared: The diff changes provider payload selection and tests only; it does not add dependencies, workflows, secrets handling, install scripts, or other supply-chain execution paths.

Review findings

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:10
Review details

Best possible solution:

Land the narrow compat gate and regression tests after real gateway/provider proof or a maintainer proof override is recorded, with the changelog line removed.

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

Yes. Current main has a high-confidence source reproduction: matching DeepSeek V4 OpenAI-compatible ids reach the generic fallback, which injects native thinking without consulting compat.thinkingFormat.

Is this the best way to solve the issue?

Mostly yes. The compat gate is the narrow maintainable fix and preserves default plus explicit deepseek behavior; the release-owned changelog entry and missing real behavior proof remain before merge.

Full review comments:

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:10
    CHANGELOG.md is release-owned in this repo, and normal PRs should keep release-note context in the PR body or squash message instead. This PR already documents the provider fix in its body, so this added changelog line should be removed before merge.
    Confidence: 0.94

Overall correctness: patch is correct
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 4ad875308f5c.

Label changes

Label justifications:

  • P1: The PR addresses a linked P1 provider-routing bug that makes affected Azure Foundry DeepSeek V4 gateway deployments unusable.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides red/green unit-test output only; it still needs redacted real gateway/provider output, terminal output, logs, recording, linked artifact, or explicit maintainer proof override before merge. 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 +16, Tests +59, Docs +1. Total +76 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 1 +16
Tests 1 59 0 +59
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 77 1 +76

What I checked:

  • Current main fallback ignores compat override: On current main, the post-plugin DeepSeek V4 fallback passes isDeepSeekV4OpenAICompatibleModel directly as shouldPatchModel, so the wrapper is selected by API plus normalized model id without checking compat.thinkingFormat. (src/agents/embedded-agent-runner/extra-params.ts:805, 4ad875308f5c)
  • Shared wrapper injects native DeepSeek thinking once matched: The shared wrapper writes thinking: { type: "disabled" } for off and thinking: { type: "enabled" } plus reasoning_effort for enabled runs after shouldPatchModel returns true. (src/plugin-sdk/provider-stream-shared.ts:615, 4ad875308f5c)
  • Base OpenAI-compatible path already treats compat as the wire-format contract: The base OpenAI-completions payload builder branches on compat.thinkingFormat and only emits DeepSeek native thinking when the resolved format is deepseek; explicit model compat overrides detected defaults. (src/llm/providers/openai-completions.ts:611, 4ad875308f5c)
  • PR implements the narrow compat gate and regression cases: The PR changes the DeepSeek V4 fallback predicate to require the id match and deepSeekV4NativeThinkingAllowedByCompat, and adds tests for unset, explicit openai, thinking off, and explicit deepseek cases. (src/agents/embedded-agent-runner/extra-params.ts:805, b11e2c918f0b)
  • Latest release still has the old fallback: The latest release tag v2026.5.27 contains the same direct shouldPatchModel: isDeepSeekV4OpenAICompatibleModel fallback under the pre-rename path, so the linked issue is not already shipped-fixed. (src/agents/pi-embedded-runner/extra-params.ts:805, 27ae826f6525)
  • Repository policy makes changelog edits release-owned: Root policy says CHANGELOG.md is release-owned and normal PRs should not edit it; this PR adds one changelog line. (AGENTS.md:192, 4ad875308f5c)

Likely related people:

  • steipete: Recent GitHub commit history for both src/agents/embedded-agent-runner/extra-params.ts and src/plugin-sdk/provider-stream-shared.ts points to the agent-runtime and provider-stream refactor work, and local blame on the current fallback/wrapper lines also points to Peter Steinberger in this checkout. (role: recent provider/runtime area contributor; confidence: high; commits: bb46b79d3c14, a3ae5c83821c, 5d018034f665; files: src/agents/embedded-agent-runner/extra-params.ts, src/plugin-sdk/provider-stream-shared.ts)
  • roslinmahmud: Recent history for extensions/microsoft-foundry/shared.ts includes the DeepSeek V4 Microsoft Foundry Responses routing fix, which is adjacent to this provider compatibility path. (role: adjacent Foundry DeepSeek contributor; confidence: medium; commits: ec43acb4328b; files: extensions/microsoft-foundry/shared.ts)
  • haxudev: GitHub commit history shows the Microsoft Foundry provider was introduced in commit a16dd967..., making this person relevant for adjacent Foundry behavior review. (role: introduced Foundry provider surface; confidence: medium; commits: a16dd967da51; files: extensions/microsoft-foundry/provider.ts, extensions/microsoft-foundry/shared.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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels May 29, 2026
@steipete
steipete force-pushed the fix/deepseek-v4-thinking-format-87737 branch from b11e2c9 to 6e01e60 Compare June 7, 2026 03:32
@steipete steipete changed the title fix(agents): respect compat.thinkingFormat override for DeepSeek V4 models fix(agents): suppress DeepSeek thinking for Foundry aliases Jun 7, 2026
@steipete

steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Maintainer refresh pushed for #90520.

What changed:

  • microsoft-foundry-* DeepSeek V4 aliases now skip the DeepSeek-native thinking wrapper like canonical microsoft-foundry.
  • Non-native DeepSeek V4 compat paths still strip DeepSeek replay-only reasoning_content from assistant messages.
  • OpenRouter/Together-style reasoning controls are preserved instead of being deleted by the sanitizer.

What I tested:

  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts src/agents/embedded-agent-runner-extraparams.test.ts -> 2 files, 139 tests passed.
  • pnpm exec oxfmt --check src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts -> passed.
  • git diff --check -> passed.
  • ./.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> clean, no accepted/actionable findings.

Live-provider note:

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 7, 2026
@steipete

steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Pre-merge maintainer proof for the refreshed head 6e01e605f7918d2243d298a7479ac437a8bea5ed:

  • Focused local tests passed: node scripts/run-vitest.mjs src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts src/agents/embedded-agent-runner-extraparams.test.ts (139 tests).
  • Formatting/diff checks passed: pnpm exec oxfmt --check src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner/extra-params.deepseek-v4-thinking-format.test.ts; git diff --check.
  • Autoreview passed after follow-up fixes: ./.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main reported no accepted/actionable findings.
  • Real behavior proof gate passed after updating the PR body with the exact proof fields.
  • CI embedded-agent shard passed: checks-node-agentic-agents-embedded.

Live-provider note: I checked for a Foundry credential item and attempted the exact local gateway alias probe, but this local agent rejected the model override before provider dispatch. Issue #90520 has the reporter's live A/B proof for the same Foundry deployment: canonical microsoft-foundry/DeepSeek-V4-Pro succeeds while alias microsoft-foundry-9433/DeepSeek-V4-Pro fails with Foundry rejecting thinking; this patch removes that alias injection path and strips replayed DeepSeek fields on Foundry/non-native compat routes.

Known CI failures are unrelated to the touched embedded-runner files:

  • check-lint / check-additional-extension-bundled: existing lint issues in scripts/openclaw-cross-os-release-checks.ts, extensions/memory-core/*, extensions/device-pair/notify.ts, and src/cli/exec-approvals-cli.ts.
  • check-test-types: workflow-level type shard exit, no annotations in touched files.
  • check-additional-runtime-topology-architecture: existing architecture failure.
  • build-artifacts: gateway-watch did not report ready before the idle CPU window; channels and core-support-boundary in that job passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft Foundry DeepSeek V4 alias providers still inject thinking after #87737 fix

2 participants