Skip to content

Preserve DeepSeek V4 thinking history - #61

Merged
Ingwannu merged 1 commit into
devfrom
ingw/fix-deepseek-reasoning-history
Jul 3, 2026
Merged

Ingwannu merged 1 commit into
devfrom
ingw/fix-deepseek-reasoning-history

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • add DeepSeek V4 thinking models to the built-in DeepSeek provider preset
  • route deepseek-v4-pro / deepseek-v4-flash with preserveReasoningContentModels so assistant reasoning_content is replayed in multi-turn/tool-call history
  • map Codex xhigh to DeepSeek max while clamping lower stale requests to DeepSeek high
  • document the model-scoped decision in ADR 0003

Root Cause

DeepSeek V4 thinking mode expects prior assistant reasoning_content to be passed back in later requests. The openai-chat adapter already supported model-scoped reasoning history replay, but the built-in DeepSeek preset did not mark the V4 thinking models for that behavior, so tool/subagent continuation turns could drop the field and trigger DeepSeek 400s.

Notes

This deliberately does not enable reasoning-content replay globally, and it does not apply the V4 rule to the legacy deepseek-reasoner preset.

Addresses #58.

References:

Validation

  • bun run typecheck
  • bun test tests/reasoning-effort.test.ts tests/provider-registry-parity.test.ts tests/router.test.ts
  • bun test ./tests/

@Ingwannu
Ingwannu marked this pull request as ready for review July 3, 2026 02:45
@Ingwannu
Ingwannu merged commit d220230 into dev Jul 3, 2026
6 checks passed
@Ingwannu
Ingwannu deleted the ingw/fix-deepseek-reasoning-history branch July 3, 2026 02:45
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Co-authored-by: Ingwannu <186453546+Ingwannu@users.noreply.github.com>
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.

1 participant