Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@erikpr1994
Copy link
Contributor

@erikpr1994 erikpr1994 commented Jan 14, 2026

Summary

  • Strip [Tool Call: ...] and [Tool Result for ID ...] text blocks that leak into assistant messages when Gemini history downgrading converts tool calls without thought_signature to text
  • Strip <think>, <thinking>, <thought>, and <antthinking> tags from text content as a safety net for models that emit thinking tags in text blocks

Changes

  • Added stripDowngradedToolCallText() function to filter downgraded tool call representations
  • Added stripThinkingTagsFromText() function to filter thinking tag leaks
  • Updated extractAssistantText() to chain all three filters (Minimax XML, downgraded tool calls, thinking tags)
  • Added comprehensive test coverage (25 tests total for the module)

Test Plan

  • Unit tests added for all new filter functions
  • All 25 tests in pi-embedded-utils.test.ts pass
  • Full test suite passes (2872 tests)
  • Lint and type-check pass
  • Local security review passed (no new vulnerabilities)
  • Local code review passed

Context

When using Gemini models via the google-antigravity provider, tool calls that lack a thought_signature are downgraded to text blocks during history replay. This caused raw tool invocation syntax to leak into user-facing messages on Telegram and other surfaces.

Similarly, some models emit thinking/reasoning content wrapped in <think> tags which should not appear in final responses.

Related

🤖 Generated with Claude Code

When replaying conversation history to Gemini, tool calls without
thought_signature are downgraded to text blocks like [Tool Call: ...].
This leaked internal technical info into user-facing chat messages.

Added stripDowngradedToolCallText filter alongside existing Minimax
filter to remove these text representations before extraction.
steipete added a commit that referenced this pull request Jan 15, 2026
@steipete
Copy link
Contributor

Landed on main after rebase onto a temp branch.

Changes:

  • Preserve trailing text after downgraded tool call blocks.
  • Strip thinking tags with attributes.
  • Added coverage + changelog entry.

Commit: 2bd9e8485
Tests: pnpm lint && pnpm build && pnpm test

Thanks @erikpr1994!

@steipete steipete closed this Jan 15, 2026
steipete added a commit to mneves75/clawdbot that referenced this pull request Jan 15, 2026
cpojer pushed a commit to cpojer/clawdbot that referenced this pull request Jan 16, 2026
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.

[Bug]: Google Antigravity tool calls displayed as text instead of executed

2 participants