Skip to content

fix(google): omit empty text from tool-only continuations - #1128

Merged
mikehostetler merged 2 commits into
agentjido:mainfrom
gabrielrinaldi:fix/google-tool-only-empty-content
Oct 22, 2026
Merged

mikehostetler merged 2 commits into
agentjido:mainfrom
gabrielrinaldi:fix/google-tool-only-empty-content

Conversation

@gabrielrinaldi

@gabrielrinaldi gabrielrinaldi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Shared OpenAI normalization converts an empty assistant content list to an empty string. The Google encoder then adds an empty text part before the function calls.

Skip that normalized empty content only for model messages with nonempty tool calls. Preserve call arguments, delivered call and thinking signatures, visible text, non-collapsed text parts, and ordinary empty messages. Shared defaults are unchanged. Gemini on Vertex AI uses the same converter.

This is independent of #1127: that PR preserves genuine text thought signatures; this fix avoids inventing text for a tool-only turn.

Type of Change

  • Bug fix
  • Documentation update

Breaking Changes

No public API changes. Tool-only Gemini requests no longer contain a synthesized empty text part.

Testing

  • mix test: 5311 passed, 11 skipped, 240 excluded. Default exclusions include coverage and integration.
  • mix quality: formatting, warnings-as-errors compilation, strict Credo, and Dialyzer passed.
  • Offline native probe reproduced the extra part before the fix and verified exact signed continuation after it, with and without thinking, through buffered and streaming encoders. No HTTP dispatch.
  • Separate in-memory composition with fix(google): preserve text thought signatures across continuations #1127 preserved genuine signed empty text beside tool calls through Google buffered/streaming and Vertex encoding, including persisted string-key metadata. Neither branch includes the other's changes.
  • New guide paragraph formatted with mdformat; unrelated existing spacing is unchanged.
  • Whole-guide Markdown lint reports 19 pre-existing spacing diagnostics. The guide is byte-identical to the base outside the new paragraph; those unrelated formatting changes are intentionally excluded.
  • Full Google compatibility matrix remains unverified for this branch.

Verified with Elixir 1.20.4 / OTP 29.1.2. No live inference or fixture recording.

Draft limitation

The Google compatibility-matrix failures documented in #1127 remain unresolved. They were not rerun merely to reconfirm them, and this PR does not claim that every failure is baseline-only or that the affected-provider gate passes. Existing fixtures are unchanged. This stays draft pending compatibility acceptance.

Checklist

  • Provider-specific correction; no shared serializer change
  • Behavioral regressions cover exact calls, results, reasoning, and content preservation
  • Documentation updated
  • Conventional commit and normal commit/push hooks passed
  • CHANGELOG.md unchanged

Related Issues

Related: #1127. Downstream tracking: STR-150. This PR does not retire Starheim's local patch; that still requires a released dependency and fresh consumer verification.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@gabrielrinaldi

Copy link
Copy Markdown
Contributor Author

Same as #1127 leaving this as draft since I want to respect your choice here

@mikehostetler mikehostetler added needs_work Changes requested before merge ready_to_merge and removed needs_work Changes requested before merge labels Oct 20, 2026
@gabrielrinaldi
gabrielrinaldi marked this pull request as ready for review October 22, 2026 14:49
@mikehostetler
mikehostetler merged commit 8042c90 into agentjido:main Oct 22, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants