Skip to content

Preserve Gemini tool arguments and text thought signatures - #239

Open
mattt wants to merge 3 commits into
mainfrom
mattt/fix-issues-235-and-221
Open

Preserve Gemini tool arguments and text thought signatures#239
mattt wants to merge 3 commits into
mainfrom
mattt/fix-issues-235-and-221

Conversation

@mattt

@mattt mattt commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Gemini conversation history currently wraps tool arguments in GeneratedContent’s persistence format and drops thought signatures on text parts. This PR replays arguments from their semantic JSON and preserve signed text with its original part boundaries and position among tool calls.

Fixes #235
Fixes #221

@mattt
mattt marked this pull request as draft September 11, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation addresses both reported regressions with focused persistence changes and comprehensive request-level tests.

Pull request overview

Fixes Gemini transcript replay by preserving semantic tool arguments and signed text-part metadata across turns and serialization.

Changes:

  • Replays tool arguments from semantic JSON.
  • Persists and restores signed text-part boundaries.
  • Adds streaming and transcript round-trip coverage.
File summaries
File Description
Sources/AnyLanguageModel/Models/GeminiLanguageModel.swift Preserves Gemini arguments and signed text parts.
Sources/AnyLanguageModel/LanguageModelSession.swift Carries provider metadata into transcripts.
Sources/AnyLanguageModel/Transcript.swift Adds persisted turn-level provider metadata.
Tests/AnyLanguageModelTests/GeminiThoughtSignatureTests.swift Covers arguments, signatures, ordering, and streaming.
Tests/AnyLanguageModelTests/TranscriptTests.swift Tests provider-metadata Codable behavior.
Tests/AnyLanguageModelTests/Shared/StubURLProtocol.swift Adds SSE response support.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mattt
mattt marked this pull request as ready for review September 11, 2026 17:43
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.

Gemini replays functionCall.args using GeneratedContent's internal Codable representation Gemini: thought signatures on text parts are discarded

2 participants