Skip to content

feat(core): full end-to-end integration of customReasoningFields across serialization and provider layers#12509

Open
Yash-200608 wants to merge 3 commits into
continuedev:mainfrom
Yash-200608:main
Open

feat(core): full end-to-end integration of customReasoningFields across serialization and provider layers#12509
Yash-200608 wants to merge 3 commits into
continuedev:mainfrom
Yash-200608:main

Conversation

@Yash-200608
Copy link
Copy Markdown

@Yash-200608 Yash-200608 commented May 28, 2026

Description

This PR delivers a comprehensive architectural solution for issue #10292. Local LLM gateways, private enterprise proxies, and custom endpoints (like vLLM, Ollama, or WatsonX) often stream reasoning tokens inside arbitrary, non-standard JSON keys. Without explicit tracking, these tokens are dropped by standard parsers or leak unformatted into the main chat block.

Instead of a shallow string-matching workaround, this change introduces customReasoningFields as a core architectural property across Continue's configuration, validation, and stream-parsing layers. It maps non-standard payload delta keys natively into Continue's internal reasoning streams, routing them perfectly to the collapsible UI "Thinking" container.

Related Issues

Closes #10292

Changes Made

  • Architecture & Typings (core/index.d.ts, JSON/YAML/control-plane schemas): Added and fully integrated customReasoningFields?: string[] across model configurations, ensuring fields pass dynamically through model-add flows and browser serialization layers.
  • Encapsulation Refactor (BaseLLM, OpenAI, WatsonX): Exposed the public options accessor on the parent BaseLLM class. Replaced strict subclasses reading private internal state variables (_llmOptions), fully resolving strict TypeScript compilation and compiler isolation constraints.
  • Parser Engine (core/llm/openaiTypeConverters.ts): Integrated multi-field validation inside streaming and non-streaming event-loop blocks to match, separate, and tag custom thinking deltas cleanly as role: "thinking".
  • Testing Suite: Added robust unit testing maps validating edge-case scenarios for custom field extraction in both streaming and non-streaming contexts, alongside YAML configuration preservation tests.

How to Test

  1. Set up a local gateway or mock endpoint streaming reasoning steps inside a custom JSON payload parameter (e.g., "my_custom_thinking_key").
  2. Wire up your local project configuration block:
    {
      "model": "reasoning-model",
      "provider": "openai",
      "customReasoningFields": ["my_custom_thinking_key"]
    }
    

Summary by cubic

Adds end-to-end support for customReasoningFields to capture reasoning tokens from non-standard provider payloads and render them in the Thinking panel. Works in both streaming and non-streaming paths, with options preserved across config, schemas, serialization, and providers.

  • New Features

    • customReasoningFields?: string[] in model config and ILLM options; preserved through JSON/YAML (packages/config-yaml, packages/config-types), control-plane schema, and serialization; accessible via BaseLLM.options.
    • Parsers map these fields to role: "thinking" for streaming (fromChatCompletionChunk) and non-streaming (fromChatResponse), with tests.
  • Bug Fixes

    • Drop thinking-role chunks during FIM/autocomplete streaming to prevent polluted completions.

Written for commit 81de517. Summary will update on new commits.

Review in cubic

…gFields

Signed-off-by: Yash <228875170+Yash-200608@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 28, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 14 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread core/llm/index.ts
@Yash-200608
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Bug: Cannot Parse Response From deepseek-r1:latest Correctly in JetBrains

1 participant