Skip to content

fix(pi-ai): stop sending store field to Mistral chat completions - #2541

Closed
koeria wants to merge 2 commits into
vastsa:mainfrom
koeria:fix/mistral-store-field-422
Closed

koeria wants to merge 2 commits into
vastsa:mainfrom
koeria:fix/mistral-store-field-422

Conversation

@koeria

@koeria koeria commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary / 概要

Mistral's chat completions endpoint (api.mistral.ai) rejects the OpenAI-only store field with 422 extra_forbidden, so every Mistral request through the openai-completions adapter failed (reported in #2539 with PI-Desktop 0.23.0).

Fix: treat Mistral as a non-standard provider in detectCompat inside the bundled @earendil-works/[email protected] patch — matched by provider === "mistral" or an api.mistral.ai base URL — so the adapter no longer emits store: false for Mistral. Explicit compat.supportsStore overrides still take precedence, and no other provider's detection changes.

Verified with a payload-level smoke test against the patched dist:

  • Before: Mistral request payload contained store: false (reproduces the 422)
  • After: Mistral payload has no store field; an OpenAI model still sends store: false (no regression)
  • The regenerated patch applies cleanly (git apply --check) against the pristine @earendil-works/[email protected] npm tarball

Requirement link / 需求关联

  • Linked requirement issue / 已关联对应的需求 Issue:fixes #2539

Mistral's chat completions endpoint rejects the OpenAI-only `store`
field with 422 extra_forbidden, so every Mistral request through the
openai-completions adapter failed. Treat Mistral as a non-standard
provider in detectCompat (matched by provider id or api.mistral.ai
base URL) so the adapter no longer emits `store`; explicit
`compat.supportsStore` overrides still win.

fixes vastsa#2539
@Tioit-Wang

Copy link
Copy Markdown
Collaborator

Review: the end-to-end wire-body tests cover the reported rejection and protect OpenAI defaults; the focused compat logic also composes with the existing DeepSeek replay flags. This is the stronger of the two competing fixes (#2540/#2541); please coordinate with #2540 so only one implementation lands. I did not merge: this head is based on 7254a04 and is 15 commits behind/diverged from current origin/main d07b742. Refresh the branch, rerun required CI/base gates, then request final review.

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

Correction: my earlier comment incorrectly credited #2541 with committed wire-body tests. After checking the actual diff, those tests are in #2540; #2541 changes only the vendored pi-ai patch and lockfile. I recommend coordinating on #2540 and not merging both. #2541 still needs a current-main refresh before any landing decision.

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

This issue is fixed by merged PR #2562, which selected and preserved #2540's committed wire-body regression tests. This competing implementation was not needed in addition, so I am closing it to avoid duplicate Mistral compatibility changes. Thank you for investigating the provider behavior.

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

Superseded by merged PR #2562.

@Tioit-Wang Tioit-Wang closed this Nov 24, 2026
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.

2 participants