Skip to content

fix: forward extraBodyProperties from requestOptions in autocomplete requests (#12334)#12533

Open
argahv wants to merge 1 commit into
continuedev:mainfrom
argahv:fix/12334-autocomplete-extra-body-properties
Open

fix: forward extraBodyProperties from requestOptions in autocomplete requests (#12334)#12533
argahv wants to merge 1 commit into
continuedev:mainfrom
argahv:fix/12334-autocomplete-extra-body-properties

Conversation

@argahv
Copy link
Copy Markdown

@argahv argahv commented Jun 1, 2026

Description

Fixes #12334 — autocomplete using OpenRouter (and other OpenAI-compatible providers) doesn't send requestOptions.extraBodyProperties.

Root Cause

The extraBodyProperties() method in OpenAI.ts returned {} by default. This method is used to spread extra properties into request bodies across ALL request types:

  • _streamChat (chat completions)
  • _legacystreamComplete (legacy completions — used by autocomplete when supportsFim() is false)
  • _streamFim (fill-in-the-middle)
  • _streamResponses (responses API)
  • _embed (embeddings)

While the fetch layer (fetchwithRequestOptions) also merges requestOptions.extraBodyProperties, the adapter and non-adapter paths have inconsistent coverage. This fix ensures the configured properties are explicitly included at the body construction level for ALL paths.

Changes

  1. core/llm/llms/OpenAI.ts: Changed extraBodyProperties() to return this.requestOptions?.extraBodyProperties ?? {} instead of {}
  2. core/llm/llms/stubs/ContinueProxy.ts: Added ...super.extraBodyProperties() to ensure user-configured properties propagate through the proxy
  3. core/llm/llms/OpenAI.vitest.ts: Added 2 tests verifying extraBodyProperties appear in chat and legacy completions requests

Test plan

  • New tests verify extraBodyProperties appear in streamChat body (chat completions endpoint)
  • New tests verify extraBodyProperties appear in streamChat with raw: true (legacy completions endpoint, used by autocomplete)
  • All existing tests continue to pass

Summary by cubic

Ensure requestOptions.extraBodyProperties are included in all OpenAI‑compatible request bodies, fixing missing fields in autocomplete with OpenRouter. Chat, legacy completions (autocomplete), FIM, responses, and embeddings now send custom body fields consistently. Fixes #12334.

  • Bug Fixes
    • Return this.requestOptions?.extraBodyProperties ?? {} from extraBodyProperties() in OpenAI.
    • Forward via ContinueProxy by spreading super.extraBodyProperties().
    • Add tests for chat completions and legacy completions bodies.

Written for commit 28225c8. Summary will update on new commits.

Review in cubic

@argahv argahv requested a review from a team as a code owner June 1, 2026 19:45
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 1, 2026
@argahv
Copy link
Copy Markdown
Author

argahv commented Jun 1, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

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

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.

No issues found across 3 files

Re-trigger cubic

@argahv argahv force-pushed the fix/12334-autocomplete-extra-body-properties branch 3 times, most recently from c663337 to ecadb17 Compare June 1, 2026 20:23
…requests (continuedev#12334)

The extraBodyProperties() method in OpenAI.ts returned {} by default,
causing user-configured requestOptions.extraBodyProperties to be omitted
from request bodies constructed at the class level. While the fetch layer
(fetchwithRequestOptions) also merges these properties, the adapter and
non-adapter paths have inconsistent coverage.

This commit changes extraBodyProperties() to return
this.requestOptions?.extraBodyProperties ?? {} instead of {}.

This fixes autocomplete requests (which go through streamComplete ->
_streamChat -> _legacystreamComplete) not sending extra body properties
configured via requestOptions.extraBodyProperties, while also ensuring
all request types (chat, completions, FIM, embeddings) consistently
include them.

Also fixes ContinueProxy to propagate super.extraBodyProperties().

Fixes continuedev#12334
@argahv argahv force-pushed the fix/12334-autocomplete-extra-body-properties branch from ecadb17 to 28225c8 Compare June 1, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Autocomplete using Openrouter doesn't send extraBodyProperties

1 participant