Skip to content

fix(llm): preserve native provider options - #29025

Closed
rekram1-node wants to merge 1 commit into
devfrom
fix-native-llm-options
Closed

fix(llm): preserve native provider options#29025
rekram1-node wants to merge 1 commit into
devfrom
fix-native-llm-options

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Summary

  • preserve OpenAI-compatible assistant reasoning continuation fields through native request lowering
  • align native OpenAI-compatible, Responses, and Anthropic option lowering with AI SDK behavior used by opencode
  • cover DeepSeek tool continuations, Responses encrypted reasoning options, and Anthropic adaptive thinking behavior

Problem

A native OpenAI-compatible tool continuation could omit prior assistant reasoning_content, causing DeepSeek thinking-mode requests to fail with HTTP 400. Auditing the local AI SDK source also found additional native option gaps for Responses and Anthropic models that opencode currently emits.

Changes

  • expose transformed compatible message metadata in the shape consumed by native Chat lowering
  • support reasoning_content and reasoning_details continuations and streaming deltas
  • translate documented compatible options (reasoningEffort, textVerbosity) while passing provider-specific compatible extensions through
  • preserve OpenAI Responses include, cache, reasoning, service, and continuation-related wire options
  • support Anthropic adaptive thinking, effort output configuration, and enabled-thinking token/parameter rules
  • update the native Zen recording to include the previously dropped encrypted reasoning request field

Verification

  • cd packages/llm && bun test test/provider/openai-compatible-chat.test.ts test/provider/openai-responses.test.ts test/provider/openai-chat.test.ts test/provider/anthropic-messages.test.ts && bun typecheck
  • cd packages/opencode && bun test test/session/llm-native.test.ts test/session/llm.test.ts test/session/llm-native-recorded.test.ts && bun typecheck
  • git diff --check

@rekram1-node
rekram1-node force-pushed the fix-native-llm-options branch from ab7ae0b to 0443b74 Compare May 23, 2026 23:00
@lc8882972

Copy link
Copy Markdown

尽快合并这个分支吧😭

@rekram1-node

Copy link
Copy Markdown
Collaborator Author

@lc8882972 just do this:

OPENCODE_EXPERIMENTAL_NATIVE_LLM=0

If u have that env var set this code path isnt ever hit (it isnt hit by default but this will ensure its not hit otherwise either).

@erick-dsnk

Copy link
Copy Markdown

Why is this not merged yet?

@rekram1-node

Copy link
Copy Markdown
Collaborator Author

because it's an experimental library that shouldn't be utilized unless ur opting into it, so it's lower priority to fix experimental things

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants