Skip to content

fix(providers): replay DeepSeek reasoning for opencode-zen (#994) - #1068

Open
justjxke wants to merge 2 commits into
lidge-jun:devfrom
justjxke:fix/opencode-zen-reasoning-replay
Open

fix(providers): replay DeepSeek reasoning for opencode-zen (#994)#1068
justjxke wants to merge 2 commits into
lidge-jun:devfrom
justjxke:fix/opencode-zen-reasoning-replay

Conversation

@justjxke

@justjxke justjxke commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • opencode-zen was the only OpenCode provider missing DeepSeek reasoning metadata. The fix(responses): keep DeepSeek reasoning_content on tool-call continuations (#950) #971 replay fix only fires for models in preserveReasoningContentModels, and opencode-zen declared none — so opencode-zen/deepseek-v4-flash-free tool-call continuations went upstream without the original reasoning_content, and the gateway rejected them with HTTP 400.
  • Mirrors the DeepSeek thinking metadata (preserveReasoningContentModels, reasoning-effort map, noVisionModels) that opencode-go and opencode-free already carry onto opencode-zen, covering deepseek-v4-pro, deepseek-v4-flash, and deepseek-v4-flash-free.

Closes #994

Verification

  • bun run typecheck — pass
  • bun test tests/opencode-zen-deepseek-reasoning.test.ts — pass (regression; red before fix, green after; also asserts effort mapping and that non-listed models are untouched)
  • bun test tests/provider-registry-parity.test.ts tests/opencode-go-deepseek.test.ts tests/reasoning-effort.test.ts tests/deepseek-reasoning-replay.test.ts — pass
  • bun run test — 9018 pass, 0 fail
  • bun run privacy:scan — pass

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Related

  • #950 — original report: intermittent drop of reasoning_content on tool-call continuation for DeepSeek thinking mode
  • #971 — the replay fix that covered opencode-go / opencode-free but not opencode-zen
  • #994 — regression this PR closes (same 400 via opencode-zen)

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I fixed all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features

    • Added OpenCode Zen DeepSeek model support with configurable reasoning levels, including xhigh mapped to the maximum level.
    • Preserved reasoning content across tool-call continuations for more consistent multi-step responses.
  • Bug Fixes

    • Improved tool-call handling for DeepSeek conversations.
    • Correctly identifies DeepSeek models as lacking native image understanding.

@github-actions github-actions Bot added the bug Something isn't working label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review readiness checklist

This PR is kept in draft until every requirement below is fulfilled. The tickable checklist has been added to your PR description — tick all four boxes there.

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I fixed all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

All four boxes are ticked.
Completed against head f377088; new commits after this will reset the checklist.
This pull request is already Ready for Review.
Maintainers: @lidge-jun @Ingwannu @Wibias

@github-actions
github-actions Bot marked this pull request as draft August 5, 2026 16:44
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The opencode-zen registry now configures reasoning behavior and vision routing for DeepSeek models. Integration tests verify effort mapping, reasoning replay during tool-call continuations, tool-call serialization, and non-DeepSeek behavior.

Changes

OpenCode Zen DeepSeek reasoning support

Layer / File(s) Summary
DeepSeek registry metadata and adapter validation
src/providers/registry.ts, tests/opencode-zen-deepseek-reasoning.test.ts
The registry adds reasoning-effort mappings, preserves reasoning_content during continuations, and marks listed DeepSeek models as lacking native vision support. Tests validate xhigh to max mapping, replayed reasoning content, serialized tool calls, and non-DeepSeek routing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: wibias, ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The registry changes preserve DeepSeek reasoning content and the tests cover continuation replay, addressing issue #994.
Out of Scope Changes check ✅ Passed The changes are limited to opencode-zen DeepSeek metadata and regression tests related to issue #994.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the provider fix and the DeepSeek reasoning replay change described in the pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/opencode-zen-deepseek-reasoning.test.ts`:
- Around line 75-80: Add focused image-request regression coverage near the
existing tests in tests/opencode-zen-deepseek-reasoning.test.ts for
deepseek-v4-pro, deepseek-v4-flash, and deepseek-v4-flash-free. Exercise the
noVisionModels configuration from the provider registry and assert each model
follows its expected no-vision or vision-sidecar path, while preserving the
existing reasoning replay tests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 97e90f8b-4585-4bad-8c33-eb36766bf9fa

📥 Commits

Reviewing files that changed from the base of the PR and between 0e92714 and 391bae1.

📒 Files selected for processing (2)
  • src/providers/registry.ts
  • tests/opencode-zen-deepseek-reasoning.test.ts

Comment thread tests/opencode-zen-deepseek-reasoning.test.ts
@justjxke
justjxke marked this pull request as ready for review August 5, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant