Skip to content

fix(sdk): surface proxy request validation errors#12550

Open
RuchirSingh1000 wants to merge 1 commit into
continuedev:mainfrom
RuchirSingh1000:fix/sdk-proxy-request-validation
Open

fix(sdk): surface proxy request validation errors#12550
RuchirSingh1000 wants to merge 1 commit into
continuedev:mainfrom
RuchirSingh1000:fix/sdk-proxy-request-validation

Conversation

@RuchirSingh1000
Copy link
Copy Markdown

@RuchirSingh1000 RuchirSingh1000 commented Jun 4, 2026

Description

createOpenAIClient currently builds useful validation errors when a request references a model that is missing from the assistant config, or when that model has no apiKeyLocation / envSecretLocations. Those errors are inside the same broad try/catch used for JSON parsing, so they are swallowed and the SDK silently forwards the original request body without continueProperties.

This separates JSON parsing fallback from assistant-model validation:

  • non-JSON request bodies still pass through unchanged
  • missing assistant models now fail fast with the existing error message
  • models without a secret location now fail fast instead of sending an unusable proxy request

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

N/A - SDK request validation fix.

Tests

  • npm.cmd test -- createOpenAIClient.test.ts --runInBand from packages/continue-sdk/typescript
  • git diff --check

I also tried npm.cmd test -- --runInBand and npx.cmd tsc --noEmit from packages/continue-sdk/typescript. The focused regression test passes, but the full package checks are currently blocked in this local checkout by existing generated/local package resolution issues (../api/dist/index.js and @continuedev/config-yaml).


Summary by cubic

Surface proxy request validation errors in the SDK by separating JSON parsing from model validation in createOpenAIClient. Non-JSON bodies pass through unchanged; missing models or models without secret locations now fail fast with clear errors.

  • Bug Fixes
    • Introduced addContinuePropertiesToBody to attach continueProperties only for JSON bodies.
    • Preserve original body for non-JSON POST requests.
    • Throw clear errors for missing assistant models or missing apiKeyLocation/envSecretLocations.
    • Added unit tests covering pass-through, success, and error cases.

Written for commit 9739005. Summary will update on new commits.

Review in cubic

@RuchirSingh1000 RuchirSingh1000 requested a review from a team as a code owner June 4, 2026 08:49
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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


Your Name seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@RuchirSingh1000
Copy link
Copy Markdown
Author

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

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 2 files

Re-trigger cubic

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.

1 participant