Skip to content

[Provider compatibility] Chat Completions ingress forwards assistant reasoning_content to Mistral - every follow-up request is rejected with 422 (2.99.0) #8420

Closed as not planned

Description

@Masih-0x3

Client or integration

OpenCode 2.2.6 (desktop/TUI and opencode run), connected as an OpenAI-compatible provider using the model blocks from Connect > API Keys (OpenCode tab), against a self-hosted OpenCodex 2.99.0 hub.

Provider or upstream service

Mistral routes with dashboard-issued custom model IDs (deepseek-v4-1-flash-1017, zai-glm-5-3, zai-glm-5-3-flash, all mistral/*), forwarded to api.mistral.ai (Mistral API key). Mistral's strict Chat schema per #8278.

OpenCodex version

2.99.0

Endpoint or capability

/v1/chat/completions — Chat Completions ingress, native Chat-to-Chat passthrough, reasoning_content in assistant message history.

Current behaviour

The first request of a conversation succeeds (post the #8251 reasoning-levels fix). Every follow-up request whose message history contains an assistant message carrying reasoning_content is rejected with HTTP 422 and the generic client message The provider rejected the request. Repeating or resuming the conversation keeps failing, so every multi-turn or tool-loop session on Mistral routes dies on the second request and cannot be resumed on that provider.

Client-side note: OpenCode replays reasoning_content unconditionally for openai-compatible reasoning models. Neither removing compatibility.reasoningField nor capabilities.reasoning.supported: false disables the replay, so there is no client workaround.

Control: the identical payload with the reasoning_content field removed from the assistant message returns HTTP 200. The same client shape (assistant tool_calls + tool result replay, no reasoning field) succeeds on other hub routes.

Expected behaviour

For Mistral-destination Chat Completions requests, strip per-message reasoning fields (reasoning_content, reasoning) from assistant messages before forwarding — the per-message counterpart of the #8278 top-level Mistral wire policy. Given #7140 already adds per-destination restore logic for upstreams that require replay, this is the strip counterpart for upstreams that reject it. The policy should also apply to custom-named Mistral model IDs created from the dashboard export (cf. #4632, custom-named entries not inheriting compatibility metadata). Alternatively, a clear "unsupported combination" error instead of a generic 422.

Minimal redacted request or reproduction

Against a 2.99.0 hub, model mistral/deepseek-v4-1-flash-1017, max_tokens: 24:

Fails (422):

{"model":"mistral/deepseek-v4-1-flash-1017","max_tokens":24,"messages":[
  {"role":"user","content":"hi"},
  {"role":"assistant","content":"Hello.","reasoning_content":"greeting"},
  {"role":"user","content":"and goodbye"}
]}

Passes (200) — same payload minus reasoning_content:

{"model":"mistral/deepseek-v4-1-flash-1017","max_tokens":24,"messages":[
  {"role":"user","content":"hi"},
  {"role":"assistant","content":"Hello."},
  {"role":"user","content":"and goodbye"}
]}

Also 200: assistant history with tool_calls + tool result and no reasoning fields. Also 422: assistant message with reasoning_content alongside tool_calls. Reproduced 2026-11-09T03:09Z on 2.99.0.

Actual response or error

HTTP 422
{"error":{"message":"The provider rejected the request.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}

The generic wrapper hides the upstream detail, so the client cannot tell which field caused the rejection.

Additional context

Activity

  1. added
    provider-compatibility
    provider
    tools
    on Nov 9, 2026
  2. github-actions commented on Nov 9, 2026

    @github-actions
    Contributor

    Issue closed: insufficient detail

    Thanks for taking the time to submit this issue. It was closed automatically because the structured report is missing information needed to evaluate or reproduce it.

    • Upstream documentation is empty without stating that no public specification exists.

    Please edit the issue to add:

    • Add a URL to the provider specification, or state that no public spec exists.

    See the Contributing guide for details.

    Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.

  3. lidge-jun commented on Nov 11, 2026

    @lidge-jun
    Owner

    The defect described here is fixed on dev by #8432 (merge commit 8b1dcb3). Canonical key-auth Mistral Chat now drops replayed reasoning_content from message history on both the native and translated paths, and native reasoning replay can no longer restore it. This issue was closed by automation before that landed; this note records the fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerprovider-compatibilitytools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions