Skip to content

fix(translate): filter empty reasoning before input IR - #717

Merged
Menci merged 2 commits into
mainfrom
fix/empty-input-reasoning
Nov 13, 2026
Merged

Menci merged 2 commits into
mainfrom
fix/empty-input-reasoning

Conversation

@Menci

@Menci Menci commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Empty Responses reasoning summaries and Gemini thought parts could enter input IR and become { type: "thinking", thinking: "", signature: "" } on Messages targets. The reported Responses request contains 28 such empty summaries.

Filter empty reasoning before constructing input IR. The Responses reader removes empty text parts from summary and content and omits reasoning when both channels are empty. The Gemini reader skips empty thought text. The Messages reader skips empty thinking before segmenting visible text, so an empty block cannot split adjacent text. Chat Completions reasoning extensions already stay outside input IR; a regression test covers their empty forms.

Nonempty text and Gemini reasoning positions remain intact. Authenticated native replay continues to preserve signed thinking blocks whose text is empty.

Test Plan

  • Regression tests reproduce empty Responses reasoning entering IR and Messages output, empty Gemini thoughts entering IR, and empty Messages thinking splitting adjacent visible text before the fix.
  • Ten related test files pass (275 tests), covering all four source readers, Responses native replay, Responses-to-Messages, Responses-to-Chat, Gemini-to-Messages, Messages-to-Responses, and protocol round trips.
  • Translate typecheck and ESLint on all changed files pass.
  • Reading the captured request's 80 reasoning items produces zero input-IR reasoning items; 28 have empty-text summaries and the remaining 52 have no readable text.
  • Authenticated native Messages replay preserves an empty thinking block and its signature.
  • All 21 Verify CI checks pass for head 78c262d95689c9b226e5d36ef441f53c4812cee7.

Responses reasoning can contain summary or content arrays whose text is entirely empty. Treating array presence as readable content produced empty thinking blocks with empty signatures on Messages targets.

Discard empty text parts while reading Responses input, and omit reasoning when neither channel contains text. Preserve nonempty text and authenticated native replay, including signed empty thinking blocks.

Cover empty and mixed channels at the IR boundary, the Messages tool-history projection, and signed native replay.
Skip empty Gemini thoughts before emitting input reasoning, and skip empty Messages thinking before flushing adjacent visible text. Keep nonempty reasoning text and positional identities intact.

Cover empty reasoning at every source boundary, including Chat extensions, and update the Gemini-to-Messages expectation to omit empty thought history.
@Menci Menci changed the title fix(translate): filter empty Responses reasoning before input IR fix(translate): filter empty reasoning before input IR Nov 13, 2026
@Menci
Menci merged commit 02f819f into main Nov 13, 2026
21 checks passed
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.

1 participant