Skip to content

fix(agents): sanitize Minimax tool-call IDs to prevent midstream errors - #24599

Closed
2undvierzig wants to merge 3 commits into
openclaw:mainfrom
2undvierzig:fix/minimax-tool-call-id-sanitization
Closed

2undvierzig wants to merge 3 commits into
openclaw:mainfrom
2undvierzig:fix/minimax-tool-call-id-sanitization

Conversation

@2undvierzig

@2undvierzig 2undvierzig commented Feb 23, 2026 •

Copy link
Copy Markdown

Summary

  • Minimax models (via OpenRouter) generate tool-call IDs with underscores (e.g. call_function_759rbkpbamq8_1) that cause mismatches after the OpenRouter proxy translates between formats
  • Add isMinimaxModel() detection (direct provider + model ID hint) and include Minimax in sanitizeToolCallIds
  • Fixes "tool result tool id not found" midstream errors and subsequent "Invalid Input" rejections from corrupted session history

Test plan

  • Unit tests for Minimax via OpenRouter, direct Minimax, and minimax-cn providers
  • Verify with openrouter/minimax/minimax-m2.5 model in production (hotfix already deployed and working)

🤖 Generated with Claude Code

Greptile Summary

Fixed tool-call ID mismatch errors for Minimax models by adding ID sanitization. Minimax (via OpenRouter or direct) generates tool-call IDs with underscores like call_function_759rbkpbamq8_1 that cause "tool result tool id not found" errors after format translation. The fix adds isMinimaxModel() detection and includes Minimax in the existing sanitizeToolCallIds logic (strips non-alphanumeric characters) to match the pattern used for Google, Mistral, and Anthropic models.

Key changes:

  • Added isMinimaxModel() helper matching existing isMistralModel() pattern - checks provider (minimax, minimax-cn) or model ID hints (minimax)
  • Enabled sanitizeToolCallIds and toolCallIdMode: "strict" for Minimax models in resolveTranscriptPolicy()
  • Three new unit tests covering OpenRouter/Minimax, direct Minimax provider, and minimax-cn provider
  • Unrelated .gitignore additions for Claude Code local config and documentation files

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix follows established patterns in the codebase (identical structure to isMistralModel()), adds comprehensive test coverage for all three Minimax provider variants, and addresses a concrete production issue (hotfix already deployed). The logic is straightforward - adding Minimax to the existing tool-call ID sanitization that already works for Google/Mistral/Anthropic. The .gitignore changes are innocuous local development artifacts.
  • No files require special attention

Last reviewed commit: 122564d

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

Your Name and others added 2 commits February 23, 2026 15:46
Replace .claude/settings.json with .claude/ to cover the entire
directory. Add architektur.md and claude-code-optimierung.md as
local-only documentation files.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Minimax models (via OpenRouter) generate tool-call IDs with underscores
(e.g. call_function_759rbkpbamq8_1) that cause mismatches after the
OpenRouter proxy translates between formats. This resulted in:
- 'tool result tool id not found' midstream errors
- Subsequent 'Invalid Input' rejections from corrupted session history

Add isMinimaxModel() detection (direct provider + model ID hint) and
include Minimax in sanitizeToolCallIds so IDs are rewritten to strict
alphanumeric format before being sent to the API.
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Feb 23, 2026
Move personal config entries (.claude/, architektur.md, etc.) out of
repo .gitignore — these belong in ~/.gitignore_global.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 3, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants