Repository navigation
Description
Client or integration
Claude Code / OpenAI-compatible routing through a provider row whose configured name differs from the built-in registry id, while its fixed upstream endpoint is a known OpenCodex provider destination.
Provider or upstream service
Concrete reproduction: official DeepSeek API at https://api.deepseek.com, configured under the name DeepSeek instead of registry id deepseek; model deepseek-flash.
OpenCodex version
2.54.0 on Linux, reproduced 2026-09-13/14.
Current behaviour
OpenCodex already has destination-based enrichment for custom provider names. When the name lookup misses but the fixed endpoint matches a known registry entry, enrichProviderFromRegistry() calls enrichReasoningMetadataByDestination().
That fallback currently restores only part of the reasoning contract (summary/effort metadata). It can omit transport-critical compatibility metadata such as:
preserveReasoningContentModels;requiresReasoningPlaceholderModels;autoToolChoiceOnlyModels.
For DeepSeek thinking mode, those are not cosmetic picker hints. Missing replay metadata can cause a later tool-call continuation to be sent without reasoning_content, which upstream rejects with:
The `reasoning_content` in the thinking mode must be passed back to the API.
Missing the tool-choice metadata separately leaves forced/required selectors eligible for the same custom-named provider even though DeepSeek thinking mode only accepts automatic selection.
Why this is distinct from existing replay issues
This is not the bounded replay-cache miss from #1193 and not the ordinary replay path from #950. Those issues assume the effective provider is already correctly opted into reasoning replay.
Here the failure happens earlier: a custom/case-changed provider name on a known fixed endpoint can fail to inherit the registry contract at all.
Minimal reproduction
{
"providers": {
"DeepSeek": {
"adapter": "openai-chat",
"baseUrl": "https://api.deepseek.com",
"models": ["deepseek-flash"]
}
}
}Then load/enrich the row through production config logic and compare it with the built-in deepseek row. Before the local fix, the destination fallback does not necessarily restore the full replay/tool-choice metadata even though the endpoint is the same trusted fixed destination.
A real multi-turn Claude Code session on this shape produced repeated final 400s after earlier combo targets were unavailable:
Provider error 400: {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
Root cause
enrichReasoningMetadataByDestination() is intentionally narrow, but it is narrower than the wire contract it is trying to reconstruct. The built-in DeepSeek entry declares replay/tool-choice behaviour, while the custom-name fallback only restores effort/summary metadata.
The router already resolves the endpoint through registryEntryForProviderDestination(), which is restricted to known fixed key destinations. That gives a safe authority boundary for copying these model-scoped compatibility lists as fill-only defaults.
Suggested fix
When a custom provider matches a known fixed registry destination, fill these lists when the user did not explicitly provide them:
if (!prov.preserveReasoningContentModels && destination?.preserveReasoningContentModels) {
prov.preserveReasoningContentModels = [...destination.preserveReasoningContentModels];
}
if (!prov.requiresReasoningPlaceholderModels && destination?.requiresReasoningPlaceholderModels) {
prov.requiresReasoningPlaceholderModels = [...destination.requiresReasoningPlaceholderModels];
}
if (!prov.autoToolChoiceOnlyModels && destination?.autoToolChoiceOnlyModels) {
prov.autoToolChoiceOnlyModels = [...destination.autoToolChoiceOnlyModels];
}Important: an explicit [] remains an operator opt-out and must not be overwritten.
Local verification
A bounded local patch adds regression coverage showing:
- custom
DeepSeekon the official endpoint inherits the replay list; - an explicit empty replay list remains empty;
- the effective deployed provider exposes both replay and auto-tool-choice model lists;
- production serialization of a tool-call continuation includes the original
reasoning_content.
Focused test suites pass with no regressions.
Checks
- I searched [Bug] OpenCode Go DeepSeek V4 Flash intermittently drops reasoning_content on tool-call continuation #950, The request couldn’t be completed. #994, [Bug] preserveReasoningContentModels still emits bare tool_call continuations when the replay cache misses (long sessions) — DeepSeek thinking mode 400 #1193 and [Bug]: DeepSeek V4 Flash Responses continuation still drops reasoning_text on 2.12.0 #1477; they cover different replay failure paths.
- No credentials, account identifiers, private prompts, or reasoning text from real conversations are included.
- The proposed enrichment remains destination-scoped and fill-only; it does not grant arbitrary custom endpoints built-in metadata.
Activity
github-actions commentedon Sep 14, 2026
Issue closed: use an issue template
Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.
Please edit the issue to add:
See the Contributing guide for details.
Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.