-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: requiresReasoningContentOnAssistantMessages missing from ModelCompatSchema — can't replicate native DeepSeek behavior on custom providers #89660
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
requiresReasoningContentOnAssistantMessagesis used at runtime indetectCompat()/getCompat()to control whetherreasoning_content: ""is injected on assistant messages (required by DeepSeek's API). However, this field is not in the ZodModelCompatSchema, so setting it in user config triggers a.strict()validation error on gateway startup.This makes it impossible to fully replicate native DeepSeek provider behavior on a custom OpenAI-compatible proxy.
Steps to reproduce
Configure a custom provider pointing to a DeepSeek-compatible proxy:
{ "models": { "providers": { "my-proxy": { "baseUrl": "https://my-proxy.example.com/v1", "models": [ { "id": "deepseek-v4-pro", "reasoning": true, "compat": { "thinkingFormat": "deepseek", "requiresReasoningContentOnAssistantMessages": true } } ] } } } }Expected: Config accepted, runtime behavior matches native deepseek provider.
Actual: Gateway rejects with Unrecognized key(s) in object: 'requiresReasoningContentOnAssistantMessages' because ModelCompatSchema is .strict() and doesn't include this field.
Setting thinkingFormat: "deepseek" works (it IS in the schema) and correctly triggers the thinking block + reasoning_effort. But the requiresReasoningContentOnAssistantMessages flag, which controls this behavior in convertMessages(), cannot be toggled by users:
// openai-completions.ts
Currently this flag is only true when detectCompat sees provider === "deepseek" || baseUrl.includes("deepseek.com"). Custom providers never match.
Root Cause
ModelCompatSchema in zod-schema.core.ts doesn't include requiresReasoningContentOnAssistantMessages. The .strict() modifier rejects any unrecognized key.
Suggested Fix
Additional missing fields (minor)
While here, these compat fields also exist in getCompat() but are missing from the schema:
cacheControlFormat (string | undefined)
sendSessionAffinityHeaders (boolean)
supportsLongCacheRetention (boolean)
zaiToolStream (boolean)
openRouterRouting (object)
vercelGatewayRouting (object)
Expected behavior
Configuring a custom OpenAI-compatible provider with:
"compat": { "requiresReasoningContentOnAssistantMessages": true }should be accepted and cause assistant messages to include
reasoning_content: ""Actual behavior
Gateway startup fails with:
Unrecognized key(s) in object: 'requiresReasoningContentOnAssistantMessages'
because ModelCompatSchema is .strict() and does not include this field.
OpenClaw version
2026.5.28
Operating system
Linux (Ubuntu)
Install method
npm global
Model
deepseek-v4-pro
Provider / routing chain
Custom provider (e.g. Tencent TokenHub / tencentmaas-deepseek) → DeepSeek-compatible API
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response