Skip to content

[Bug]: Missing reasoning_content in /v1/chat/completions for Gemini and closed models due to hideThinkingSummary bridge suppression #7750

Closed

Description

@thyjeff

Client or integration

Direct HTTP/API client

Area

Streaming

OpenCodex version

2.92.0

Operating system

Windows 11 24H2

Provider and model

google-antigravity (Gemini), OpenAI-compatible chat providers, and closed models with inline think tags

What happened?

When streaming chat completions over /v1/chat/completions (OpenAI-compatible ingress), model thinking/reasoning (delta.reasoning_content) is omitted from the SSE chunks, even when the model generates reasoning tokens (visible in completion_tokens_details.reasoning_tokens).

Why this happens

  1. Coupling of reasoning_raw_delta to hideThinkingSummary:
    In src/bridge/sse.ts (line 1033) and src/protocols/encoders/adapter-events.ts (line 643):

    case "reasoning_raw_delta": {
      if (options?.hideThinkingSummary || options?.hideRawReasoning) {
        hiddenRawReasoning = appendString(hiddenRawReasoning, event.text, "reasoning");
        break;
      }

    Because options.hideThinkingSummary defaults to true whenever an incoming request does not supply an explicit reasoning.summary setting, all raw reasoning deltas (such as delta.reasoning_content from upstream models or parsed <think> tags) are swallowed into hiddenRawReasoning instead of being emitted as response.reasoning_text.delta.

  2. thinking_delta also swallowed when hideThinkingSummary is set:
    In src/protocols/encoders/adapter-events.ts (line 610) and src/bridge/sse.ts (line 966), thinking_delta breaks early on options.hideThinkingSummary. When converting to OpenAI Chat Completions, writer.reasoning already maps to delta.reasoning_content, so this early return drops thinking for Chat clients.

  3. Gating in src/adapters/google.ts:
    thinkingEligible is restricted to a narrow list (gemini-3.5-flash, gemini-3.6-flash, or models with preconfigured effort ladders), and includeThoughts strictly requires provider.showThinkingSummary === true. Modern Gemini 2.0+ / 2.5+ models thus never send includeThoughts: true by default unless configured.

  4. Opt-in only <think> tag parser:
    InlineThinkTagParser in src/adapters/inline-think-tags.ts requires individual model IDs in provider.inlineThinkTagModels without wildcard * support, and only matches <thinking>, <think>, <reasoning> (missing <thought>, <internal_thought>).

Expected behavior

Reasoning/thinking tokens from closed models should be forwarded downstream as delta.reasoning_content so harnesses and OpenAI-compatible clients can render the thinking pattern.

Proposed fix

  1. Decouple raw reasoning from hideThinkingSummary:
    In src/bridge/sse.ts and src/protocols/encoders/adapter-events.ts:
    - if (options?.hideThinkingSummary || options?.hideRawReasoning) {
    + if (options?.hideRawReasoning) {
  2. Do not suppress thinking_delta unless both summary and raw reasoning are hidden:
    - if (options?.hideThinkingSummary) {
    + if (options?.hideThinkingSummary && options?.hideRawReasoning) {
  3. Default includeThoughts to true for Gemini models with thinking:
    In src/adapters/google.ts, expand thinkingEligible to recognize /^gemini-/ models, and default includeThoughts to true unless provider.showThinkingSummary === false or parsed.options.hideThinkingSummary === true.
  4. Expand tag parser and add wildcard support:
    In src/adapters/inline-think-tags.ts, add <thought> and <internal_thought> to OPEN_TAGS, and support models?.includes("*") in createInlineThinkContentSplitter.
  5. Default reasoning summary on Chat Completions:
    In src/chat/inbound.ts, set summary: summary ?? "auto" unless raw.include_reasoning === false.

Activity

  1. added
    bug
    streaming
    on Oct 26, 2026
  2. added a commit that references this issue on Oct 27, 2026
    3481ace
  3. lidge-jun commented on Oct 27, 2026

    @lidge-jun
    Owner

    Fixed on dev by #7833 (merge commit 3481ace). A /v1/chat/completions client that sends no reasoning options now receives upstream raw reasoning as delta.reasoning_content (streaming) or message.reasoning_content (buffered). This covers direct encoders, the internal Responses bridge, runTurn, and the web-search and image/video sidecars. It stays hidden when the caller asks (include_reasoning: false, reasoning.summary: "none", reasoning_effort: "none", reasoning.enabled: false, thinking.type: "disabled") or when the provider sets hideRawReasoning. Upstream requests are unchanged; Gemini thinking eligibility, includeThoughts defaults and inline think-tag parsing are unchanged, so models that do not return reasoning to OpenCodex still show none. Closing; it ships with the next release.

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

    bugstreaming

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions