Skip to content

fix(provider): preserve DeepSeek V4 output limit - #38232

Closed
punkisnotdead3 wants to merge 5 commits into
anomalyco:devfrom
punkisnotdead3:deepseek-v4-output
Closed

punkisnotdead3 wants to merge 5 commits into
anomalyco:devfrom
punkisnotdead3:deepseek-v4-output

Conversation

@punkisnotdead3

@punkisnotdead3 punkisnotdead3 commented Jul 22, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #38236

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The global 32K default in ProviderTransform.maxOutputTokens() overrides DeepSeek V4's declared 384K/393,216-token output limit.

This keeps the existing 32K default for other model families, but lets DeepSeek V4 use its positive model-declared output limit when no runtime override is configured. An explicit OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX remains authoritative.

How did you verify your code works?

  • bun test test/provider/transform.test.ts — 363 passed
  • bun typecheck
  • bun run lint packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.ts — 0 errors
  • bunx prettier --check packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.ts
  • Push hook: repository-wide Turbo typecheck — 30/30 packages passed

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@punkisnotdead3

Copy link
Copy Markdown
Author

Hi maintainers — I synced this PR with the latest dev in 24f523b and re-verified the focused change:

  • bun test test/provider/transform.test.ts — 418 passed
  • bun --bun run typecheck
  • Prettier and lint — 0 errors
  • repository-wide pre-push typecheck — 30/30 packages passed

Could a maintainer please approve the pending test, typecheck, and nix-eval fork workflows and review the PR? Thanks!

# Conflicts:
#	packages/opencode/test/provider/transform.test.ts
@punkisnotdead3

Copy link
Copy Markdown
Author

Synced again with current dev in 31f8b4195a and resolved the test-file conflict.

Validation:

  • focused ProviderTransform.maxOutputTokens tests: 7 passed
  • bun --bun run typecheck
  • Prettier and lint: 0 errors
  • repository-wide pre-push typecheck: 30/30 packages passed

The PR is mergeable again. The pending test, typecheck, and nix-eval workflows still require maintainer approval. I also clarified in #38236 why this is a narrow DeepSeek-specific fix rather than a duplicate of #29363.

One unrelated Vertex Anthropic block_binding test currently fails locally; its implementation and assertion are outside this PR diff.

iceteaSA added a commit to iceteaSA/opencode that referenced this pull request Sep 23, 2026
PR anomalyco#38232 (anomalyco#38232) adds isDeepSeekV4 which calls
model.api.id.toLowerCase() unguarded. The fork's session/compaction
tests build Provider.Model instances with no api.id, and overflow.ts
calls maxOutputTokens without an explicit cap, so the unguarded access
throws. Guard the field so non-DeepSeek models with no api.id still
flow through.
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Oct 10, 2026
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.

DeepSeek V4 output limit is capped at 32K

2 participants