Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 11, 2026

Related GitHub Issue

Closes: #11395

Description

This PR attempts to address Issue #11395. When using the OpenAI-compatible provider with APIs like VolcEngine (ark-code-latest), enabling "Reasoning Effort" sends reasoning_effort in the request body but does NOT send a thinking parameter. VolcEngine's API defaults thinking to disabled when omitted, and the combination reasoning_effort: "high" + thinking: disabled is rejected as HTTP 400.

How it works:

A custom fetch wrapper (createThinkingAwareFetch) is passed to the createOpenAI provider factory. For any request body that already contains reasoning_effort but lacks a thinking field, the wrapper injects thinking: { type: "enabled" }. Standard OpenAI endpoints silently ignore unknown body fields, so this is safe for all OpenAI-compatible providers.

Key details:

  • Only affects the non-Azure, non-Azure-AI-Inference code path (the generic createOpenAI path)
  • Does not overwrite an existing thinking field if one is already present
  • Passes through non-JSON bodies and requests without bodies unchanged

Test Procedure

  • Added 5 new unit tests for createThinkingAwareFetch covering:
    1. Injecting thinking when reasoning_effort is present
    2. Not injecting thinking when reasoning_effort is absent
    3. Not overwriting an existing thinking parameter
    4. Passing through non-JSON bodies unchanged
    5. Passing through requests with no body
  • Updated existing constructor test to verify fetch is passed to createOpenAI
  • All 49 tests in openai.spec.ts pass
  • All related OpenAI test files (openai-native, openai-codex, openai-usage-tracking) also pass

Run tests: cd src && npx vitest run api/providers/__tests__/openai.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome.

…effort

When reasoning_effort is set, OpenAI-compatible APIs like VolcEngine
default "thinking" to "disabled", causing a 400 error. This adds a
fetch wrapper that injects thinking: { type: "enabled" } into
request bodies that contain reasoning_effort but lack a thinking field.

Standard OpenAI endpoints silently ignore unknown body fields,
so this is safe for all OpenAI-compatible providers.

Closes #11395
@roomote
Copy link
Contributor Author

roomote bot commented Feb 11, 2026

Rooviewer Clock   See task

Review complete. No issues found. The fetch wrapper approach is clean, well-scoped, and handles edge cases properly.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

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.

[BUG] Missing parameter "thinking"

1 participant