Repository navigation
Description
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
-
Coupling of
reasoning_raw_deltatohideThinkingSummary:
Insrc/bridge/sse.ts(line 1033) andsrc/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.hideThinkingSummarydefaults totruewhenever an incoming request does not supply an explicitreasoning.summarysetting, all raw reasoning deltas (such asdelta.reasoning_contentfrom upstream models or parsed<think>tags) are swallowed intohiddenRawReasoninginstead of being emitted asresponse.reasoning_text.delta. -
thinking_deltaalso swallowed whenhideThinkingSummaryis set:
Insrc/protocols/encoders/adapter-events.ts(line 610) andsrc/bridge/sse.ts(line 966),thinking_deltabreaks early onoptions.hideThinkingSummary. When converting to OpenAI Chat Completions,writer.reasoningalready maps todelta.reasoning_content, so this early return drops thinking for Chat clients. -
Gating in
src/adapters/google.ts:
thinkingEligibleis restricted to a narrow list (gemini-3.5-flash,gemini-3.6-flash, or models with preconfigured effort ladders), andincludeThoughtsstrictly requiresprovider.showThinkingSummary === true. Modern Gemini 2.0+ / 2.5+ models thus never sendincludeThoughts: trueby default unless configured. -
Opt-in only
<think>tag parser:
InlineThinkTagParserinsrc/adapters/inline-think-tags.tsrequires individual model IDs inprovider.inlineThinkTagModelswithout 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
- Decouple raw reasoning from
hideThinkingSummary:
Insrc/bridge/sse.tsandsrc/protocols/encoders/adapter-events.ts:- if (options?.hideThinkingSummary || options?.hideRawReasoning) { + if (options?.hideRawReasoning) {
- Do not suppress
thinking_deltaunless both summary and raw reasoning are hidden:- if (options?.hideThinkingSummary) { + if (options?.hideThinkingSummary && options?.hideRawReasoning) {
- Default
includeThoughtsto true for Gemini models with thinking:
Insrc/adapters/google.ts, expandthinkingEligibleto recognize/^gemini-/models, and defaultincludeThoughtstotrueunlessprovider.showThinkingSummary === falseorparsed.options.hideThinkingSummary === true. - Expand tag parser and add wildcard support:
Insrc/adapters/inline-think-tags.ts, add<thought>and<internal_thought>toOPEN_TAGS, and supportmodels?.includes("*")increateInlineThinkContentSplitter. - Default reasoning summary on Chat Completions:
Insrc/chat/inbound.ts, setsummary: summary ?? "auto"unlessraw.include_reasoning === false.
Activity
fix(reasoning): unblock reasoning_raw_delta in bridge SSE and support…
fix(reasoning): unblock reasoning_content on chat completions and bro…
fix(chat): deliver upstream raw reasoning to Chat clients without a g…
lidge-jun commentedon Oct 27, 2026
Fixed on
devby #7833 (merge commit 3481ace). A/v1/chat/completionsclient that sends no reasoning options now receives upstream raw reasoning asdelta.reasoning_content(streaming) ormessage.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 setshideRawReasoning. Upstream requests are unchanged; Gemini thinking eligibility,includeThoughtsdefaults 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.