fix(session): normalize tool call blocks for cross-provider compatibility#5482
Closed
bse-ai wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(session): normalize tool call blocks for cross-provider compatibility#5482bse-ai wants to merge 1 commit intoopenclaw:mainfrom
bse-ai wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…lity
When users switch providers mid-session (e.g., from Google Antigravity to
Anthropic), the session history may contain tool call blocks in different
formats:
- Anthropic / pi-ai: `{ type: "toolCall", arguments: {} }`
- Google Antigravity: `{ type: "toolUse", input: {} }`
This mismatch causes API validation failures like "input: Field required"
when the new provider's serializer encounters the old format.
This fix adds `normalizeToolCallBlocks()` to the session sanitization
pipeline, which converts all tool call variants (toolCall, toolUse,
functionCall) to the canonical `{ type: "toolCall", arguments: {} }` shape
before sending to any provider.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This was referenced Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toolUse,toolCall,functionCall) to canonical shape before sending to any providerProblem
When users switch providers mid-session (e.g., from Google Antigravity to Anthropic), the session history may contain tool call blocks in different formats:
{ type: "toolCall", arguments: {} }{ type: "toolUse", input: {} }This mismatch causes API validation failures.
Solution
Adds
normalizeToolCallBlocks()to the session sanitization pipeline, converting all tool call variants to the canonical{ type: "toolCall", arguments: {} }shape.Test plan
🤖 Generated with Claude Code
Greptile Overview
Greptile Summary
This PR appears to normalize tool-call blocks in the Pi embedded runner's Google provider integration so that session history remains compatible when switching between AI providers mid-session. The change introduces (or wires in) a normalization step that converts provider-specific tool call variants (e.g.,
toolUsewithinput) into a canonical shape (toolCallwitharguments) before sending history to downstream providers, preventing schema validation errors likeinput: Field required.Confidence Score: 5/5
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)