Skip to content

[Bug] JEV re-decides on a tool continuation and sends a bare tool call to DeepSeek (reasoning_text 400) #7298

Closed

Description

@peidooong

Client or integration

Codex App

Area

Proxy and routing

Summary

A JEV combo re-decides the target on every request. In a tool-call loop, the first request selected openai/gpt-6.1-sol; after the tool result, the continuation re-decided to deepseek/deepseek-flash and sent a bare tool continuation with no replayable reasoning_text, so DeepSeek returned HTTP 400.

The existing candidate compatibility check does not catch this shape:

  • mandatoryResponsesReasoningReplayUnavailable requires hasOpaqueOnlyReasoningItem(body), which only matches an existing type: "reasoning" item carrying encrypted_content and no plaintext.
  • The Sol tool-call turn carried no reasoning item at all (reasoningOutputTokens: 0), so the check returns false.
  • Even with an opaque item, tupleForServingIdentity requires credentialDurableIdentity. A direct Codex-login forward has no pool context, so it has no durable scope and the check fails open.
  • plaintextReasoningBackfill only backfills an existing reasoning item; it cannot invent one for a bare tool continuation.

The result is that DeepSeek remains eligible and OpenCodex sends a request that must 400. This is not a user configuration mistake.

Reproduction

Combo Auto: strategy: "jev", six targets (openai/gpt-6.1-sol, openai/gpt-6-astra, deepseek/deepseek-flash, openai/gpt-6-luna, google/gemini-3.8-flash, google/gemini-4-argon), reasoningEffortMode: "adaptive".

DeepSeek provider: adapter: "openai-responses", preserveResponsesReasoningContent: true, requiresAdjacentResponsesToolResults: true, statelessResponses: true.

Timeline (Asia/Shanghai):

Time Request JEV choice Result
12:42:34.763 ocx-483c9a0f91e86fd3c699aeb2ad338584 openai/gpt-6.1-sol (confidence 0.36) 200
12:42:45 Sol starts a tool call — Tool result returned
12:42:47.161 ocx-03f32cc49f87e378d58efdcd0b7a3573 deepseek/deepseek-flash (confidence 0.33) 400

Both usage.jsonl records show:

  • routeDecision.requirements: []
  • All six candidates have eligible: true
  • The second record's selected is deepseek/deepseek-flash
  • The first attempt is openai/gpt-6.1-sol[openai-responses], with no accountLogLabel and reasoningOutputTokens: 0

Version

2.88.0

Operating system

Windows 11 家庭版 10.0.26200 build 26200

Provider and model

deepseek / deepseek-flash (via the Auto JEV combo; the first target was openai / gpt-6.1-sol)

Logs or error output

Provider error 400: {"error":{"message":"The `reasoning_text` in the thinking mode must be passed back to the API. (request_id: 470b8d6e-5e4c-486b-b9c2-e54e579a8435)","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}

Key usage.jsonl fields:

{
  "requestId": "ocx-03f32cc49f87e378d58efdcd0b7a3573",
  "status": 400,
  "attempts": [
    { "provider": "deepseek", "model": "deepseek-flash", "adapter": "openai-responses", "status": 400 }
  ],
  "routeDecision": { "requirements": [], "selected": { "provider": "deepseek", "model": "deepseek-flash" } },
  "jevDecision": { "confidence": 0.33, "chosenProbability": 0.36 }
}

Screenshots and supporting files

No extra files; request IDs and the usage excerpts above are sufficient.

Redacted configuration

{
  "combos": {
    "Auto": {
      "strategy": "jev",
      "reasoningEffortMode": "adaptive",
      "targets": [
        { "provider": "openai", "model": "gpt-6.1-sol" },
        { "provider": "openai", "model": "gpt-6-astra" },
        { "provider": "deepseek", "model": "deepseek-flash" },
        { "provider": "openai", "model": "gpt-6-luna" },
        { "provider": "google", "model": "gemini-3.8-flash" },
        { "provider": "google", "model": "gemini-4-argon" }
      ]
    }
  },
  "providers": {
    "deepseek": {
      "adapter": "openai-responses",
      "preserveResponsesReasoningContent": true,
      "requiresAdjacentResponsesToolResults": true,
      "statelessResponses": true
    }
  }
}

Additional analysis

Two possible fixes:

  1. Config workaround (verified against 2.88.0): force deepseek-flash to the Chat wire with providers.deepseek.modelAdapters = {"deepseek-flash": "openai-chat"}. The Chat adapter already injects reasoning_content: " " when a tool-call assistant turn has no reasoning (the DeepSeek thinking mode HTTP 400 (reasoning_text must be passed back) when a routed subagent thinking turn lost its reasoning text #5421 mechanism). I validated the config, the wire resolver, and a full Responses → proxy → mock DeepSeek Chat request. Tradeoff: it moves all deepseek-flash traffic off the native Responses wire and may change Responses-only behavior such as apply_patch or summary handling.

  2. Fail-closed eligibility check: in mandatoryResponsesReasoningReplayUnavailable, when the destination requires plaintext reasoning and the request is a tool continuation (function_call/custom_tool_call plus its output) with no replayable plaintext reasoning (reasoning_text, or summary_text that the serializer can backfill), return ineligible even when the previous route identity is unknown:

if (
  adapterName !== "openai-responses"
  || !requiresPlaintextReasoningReplay(provider)
  || !clientThreadId
  || !requestCarriesTools(body)
) return false;

if (hasToolContinuation(body) && !hasPlaintextReasoningItem(body)) return true;

if (!hasOpaqueOnlyReasoningItem(body)) return false;
// ... existing identity check

This prevents the impossible request without pinning the model; JEV can choose another candidate. A local prototype passes the new unit cases (bare continuation → ineligible, plaintext reasoning → eligible, summary-only → eligible, no tools → eligible) and tests/server/server-combo-reasoning-replay-eligibility.test.ts 4/4. The full suite was not run.

The other direction is per-session pinning of the JEV target for the tool loop, as proposed in #6665.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    tools
    on Oct 18, 2026
  2. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  3. added
    bug
    proxy
    on Oct 18, 2026
  4. Ingwannu commented on Oct 18, 2026

    @Ingwannu
    Owner

    I checked dev 8640c2f30edb: core-replay.ts:mandatoryResponsesReasoningReplayUnavailable still requires an existing opaque-only reasoning item plus known serving-identity mismatch. A bare function-call/result continuation therefore misses that guard exactly as reported. This is not covered by the existing foreign-opaque regression.

    Please publish the offline prototype as a focused Draft PR against dev, using the existing server-combo-reasoning-replay-eligibility fixture rather than a new scheduler. The predicate needs stronger tests before adoption: a matching function/custom call-output pair with no reasoning item, unknown/direct-login provenance, a tools-empty continuation, plaintext/summary belonging to an earlier unrelated turn, multiple tool turns, same-route replay-cache restoration, and generic preservation-only gateways. An arbitrary plaintext item anywhere in history must not authorize a later incompatible tool round. Conversely, preservation alone must not become a strict-replay requirement. Verify zero strict-target sends and the exhausted-combo error, not just the predicate result. The Chat-wire workaround has the Responses-feature tradeoff you documented; I have not executed it or changed any installation. Target pinning in #6665 remains a separate design choice.

  5. lidge-jun commented on Oct 19, 2026

    @lidge-jun
    Owner

    Fixed by #7354 (merged into dev as f7bdd8e): a combo now keeps an in-flight tool loop on the target that issued the calls while it is still selectable, and when a switch is unavoidable the strict serializers give bare tool-call turns a minimal reasoning placeholder, so DeepSeek no longer returns 400. Related failover fixes landed in #7355. Ships in the next release.

  6. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

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

    bugproxytools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions