Skip to content

fix(minimax): disable tool call ID sanitization for Anthropic-compatible API - #67967

Closed
sebykrueger wants to merge 1 commit into
openclaw:mainfrom
sebykrueger:pr/minimax-tool-call-ids-v2
Closed

sebykrueger wants to merge 1 commit into
openclaw:mainfrom
sebykrueger:pr/minimax-tool-call-ids-v2

Conversation

@sebykrueger

Copy link
Copy Markdown

Summary

Re-opens #65371 against the current replay-hook API (the original PR was written before the buildProviderReplayFamilyHooks factory landed and no longer applies).

  • Problem: MiniMax's Anthropic-compatible API generates its own tool call IDs and rejects tool results if the echoed ID doesn't match exactly (error 2013: "tool result's tool id not found").
  • Why it matters: The default hybrid-anthropic-openai replay policy sets sanitizeToolCallIds: true + toolCallIdMode: "strict", which rewrites IDs and breaks the MiniMax roundtrip. All tool use fails.
  • What changed: Introduces a thin MINIMAX_REPLAY_HOOKS wrapper around HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS that overrides buildReplayPolicy to set sanitizeToolCallIds: false when modelApi === "anthropic-messages". MINIMAX_PROVIDER_HOOKS consumes the wrapper, so both the minimax and minimax-portal providers inherit it through a single spread.
  • What did NOT change: OpenAI-compatible paths (openai-completions) keep strict sanitization. The factory API itself isn't touched (could be a follow-up to add a sanitizeToolCallIds knob to buildProviderReplayFamilyHooks so consumers don't need the wrapper pattern).

Change Type

  • Bug fix

Scope

  • Integrations (MiniMax provider plugin)

Linked Issue/PR

Root Cause

  • Root cause: the hybrid-anthropic-openai replay policy strictly sanitizes tool call IDs, but MiniMax's Anthropic-compatible API requires byte-exact ID echo.
  • Missing detection / guardrail: no per-provider opt-out for tool-ID sanitization in the shared replay-family factory.
  • Contributing context: fix follows the same pattern used for ollama and Anthropic, but scoped via a wrapper because the factory options don't yet expose a sanitizeToolCallIds knob.

Regression Test Plan

  • extensions/minimax/index.test.ts asserts sanitizeToolCallIds: false for the minimax provider on anthropic-messages, and true for the minimax-portal provider on openai-completions. Both cases covered.

Verified locally

  • pnpm test extensions/minimax/index.test.ts — 8/8 pass
  • pnpm build clean
  • End-to-end: a production MiniMax-M2.7 deployment running via this change executes tool calls (browser, web_search, exec) without error 2013.

MiniMax generates its own tool call IDs and rejects tool results
if the echoed ID does not match exactly (error 2013). The default
strict sanitization rewrites IDs, breaking the roundtrip.

Override buildReplayPolicy for both minimax and minimax-portal
providers to set sanitizeToolCallIds: false when the API is
anthropic-messages. OpenAI-compatible paths keep sanitization.
@greptile-apps

greptile-apps Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes tool-call round-trips against MiniMax's Anthropic-compatible API by disabling sanitizeToolCallIds on the anthropic-messages path. The change introduces MINIMAX_REPLAY_HOOKS, a thin wrapper around HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS, and substitutes it into MINIMAX_PROVIDER_HOOKS so both minimax and minimax-portal inherit the fix without duplicating policy logic. OpenAI-compatible paths keep the existing strict ID sanitization unchanged.

Confidence Score: 5/5

Safe to merge — targeted single-provider fix with complete test coverage and no changes to shared SDK surfaces.

The change is narrowly scoped to the MiniMax extension, follows the established wrapper pattern used by ollama and Anthropic providers, correctly guards the non-anthropic-messages path, and the tests cover both the fixed case and the unchanged openai-completions baseline. No P0 or P1 findings identified.

No files require special attention.

Reviews (1): Last reviewed commit: "minimax: disable tool call ID sanitizati..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: current main still routes MiniMax Anthropic-compatible replay through strict tool-call ID sanitization, and this PR remains the canonical focused fix candidate. It is not merge-ready because the external PR lacks inspectable real MiniMax proof and GitHub reports the branch as conflicting with current main.

Root-cause cluster
Relationship: canonical
Canonical: #67967
Summary: This PR is the canonical open implementation candidate for the MiniMax Anthropic-compatible tool-call ID sanitization failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

No live high-confidence reproduction was run in this read-only review. Source inspection shows current main still sets strict MiniMax Anthropic-compatible tool-call ID sanitization, matching the reported error-2013 failure path, but the external API behavior still needs live proof.

Is this the best way to solve the issue?

Yes, likely: a MiniMax-owned buildReplayPolicy wrapper is the narrowest maintainable fix because runtime replay policy already delegates provider behavior to plugin hooks. A shared factory option can remain a later cleanup if more hybrid providers need the same opt-out.

Security review:

Security review cleared: Security review cleared: the diff only changes MiniMax provider replay-policy code and a focused test, with no dependency, workflow, lockfile, secrets, install, publishing, or generated-code changes.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-17T04:25:54Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • vincentkoc: Recent history shows Vincent Koc introduced the MiniMax shared provider hook bundle and the shared replay-family hook helper that this PR wraps. (role: provider replay surface contributor; confidence: high; commits: 25efa8cf8158, 39d2a719c964, 4613f121ad0f; files: extensions/minimax/provider-registration.ts, extensions/minimax/index.test.ts, src/plugin-sdk/provider-model-shared.ts)
  • jalehman: Josh Lehman authored the plugin-owned replay-policy boundary that resolveTranscriptPolicy now uses before core fallback policy. (role: introduced replay hook boundary; confidence: high; commits: c52df3287817, 799c6f40aa69, 71346940adaf; files: src/agents/transcript-policy.ts, src/plugins/provider-replay-helpers.ts)
  • steipete: Peter Steinberger has adjacent MiniMax/provider cleanup and MiniMax portal auth history in the same provider registration area, useful for review routing if the branch needs conflict resolution. (role: adjacent MiniMax and provider contributor; confidence: medium; commits: fb0d60d7f345, 0828db93e92e, 3e80bd33e419; files: extensions/minimax/provider-registration.ts, extensions/minimax/index.test.ts, src/plugin-sdk/provider-model-shared.ts)

Codex review notes: model internal, reasoning high; reviewed against 4e6933c84f18.

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR adds a MiniMax replay-policy wrapper that disables tool-call ID sanitization for anthropic-messages while preserving strict sanitization for OpenAI-compatible MiniMax paths, with a matching regression-test expectation change.

Maintainer follow-up before merge:

This is an open implementation PR that appears valid and narrowly scoped; the next action is normal maintainer review, optional live MiniMax validation, and merge or requested changes rather than a new automated replacement PR.

Review details

Best possible solution:

Land this PR or an equivalent MiniMax-owned replay-policy hook so MiniMax Anthropic-compatible requests echo provider-native tool-call IDs verbatim, while OpenAI-compatible MiniMax requests keep strict ID sanitization. A shared factory option can remain a later cleanup if additional providers need the same knob.

Acceptance criteria:

  • pnpm test extensions/minimax/index.test.ts
  • pnpm build
  • Manual/live check: configure MiniMax anthropic-messages and verify a tool call roundtrip succeeds without MiniMax error 2013

What I checked:

  • Current MiniMax wiring lacks override: Current main builds HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS and spreads it directly into MINIMAX_PROVIDER_HOOKS; there is no MiniMax-specific buildReplayPolicy wrapper or sanitizeToolCallIds: false override. (extensions/minimax/provider-registration.ts:41, acae48b790fa)
  • Current test asserts old behavior: The MiniMax provider test still expects sanitizeToolCallIds: true for provider minimax with modelApi: "anthropic-messages"; the PR changes this expected value to false. (extensions/minimax/index.test.ts:132, acae48b790fa)
  • Shared hybrid policy sanitizes Anthropic-compatible IDs: buildStrictAnthropicReplayPolicy() defaults sanitizeToolCallIds to true and sets toolCallIdMode: "strict"; buildHybridAnthropicOrOpenAIReplayPolicy() uses that strict policy for anthropic-messages. (src/plugins/provider-replay-helpers.ts:49, acae48b790fa)
  • Provider hook is the effective seam: resolveTranscriptPolicy() delegates to the runtime provider plugin's buildReplayPolicy when present, so a MiniMax-owned wrapper is the local seam for this behavior without changing core fallback policy. (src/agents/transcript-policy.ts:208, acae48b790fa)
  • Strict sanitizer rewrites non-alphanumeric IDs: Strict tool-call ID sanitization removes non-alphanumeric characters; native Anthropic ID preservation is a separate opt-in path limited to toolu_* IDs. (src/agents/tool-call-id.ts:35, acae48b790fa)
  • PR security review: The provided PR diff modifies only extensions/minimax/provider-registration.ts and extensions/minimax/index.test.ts with 19 additions and 2 deletions; it does not touch workflows, dependency sources, lockfiles, install/build scripts, publishing metadata, permissions, downloaded artifacts, generated/vendor files, or secrets handling. (8bdd08e34d87)

Likely related people:

  • steipete: Current history and blame associate the MiniMax provider hook wiring, shared replay-policy helper, transcript-policy delegation, and tool-call sanitizer with recent maintainer work, making this the best routing candidate for review of the provider-policy change. (role: recent maintainer / likely follow-up owner; confidence: high; commits: a972c9ec4547; files: extensions/minimax/provider-registration.ts, extensions/minimax/index.test.ts, src/plugins/provider-replay-helpers.ts)

Remaining risk / open question:

  • No live MiniMax Anthropic-compatible tool roundtrip was executed during this read-only review; maintainers should verify a real MiniMax tool call returns successfully without error 2013 before or after merge.

Codex review notes: model gpt-5.5, reasoning high; reviewed against acae48b790fa.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@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 Jun 6, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 7, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 20, 2026
@clawsweeper clawsweeper Bot added the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Jun 20, 2026
@clawsweeper clawsweeper Bot added the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Jun 20, 2026
@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 Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(minimax): disable tool call ID sanitization for Anthropic-compatible API This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict stalled_unproven_pr (decision packet 2026-07-25T06:10:35.581Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

@steipete steipete closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: minimax merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MiniMax tool use broken: tool call ID sanitization causes error 2013 [Bug]: MiniMax models' tool calls are stripped instead of executed

2 participants