Repository navigation
fix(agents): repair sanitized replay tool results before send - #67620
Conversation
Greptile SummaryAdds Confidence Score: 5/5Safe to merge — minimal one-line production change with targeted tests covering the fixed and adjacent cases. The change is a single flag addition that closes a clear parity gap between the native and hybrid Anthropic replay policy builders. No new logic is introduced, the helper already supports the flag, and the existing + new tests validate the before/after behavior for Claude and non-Claude model IDs going through the affected path. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): preserve native Anthropic t..." | Re-trigger Greptile |
a7e55a8 to
8dbaa33
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0b7e36f8a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b0b7e36 to
1e8b61c
Compare
obviyus
left a comment
There was a problem hiding this comment.
Verified the MiniMax replay failure came from strict outbound tool-call ID sanitization leaving orphan tool-result ids like ...toolresult1, and confirmed the landed fix re-runs pairing repair on the send path.
Maintainer follow-up: replaced the original hybrid-toolu_* replay-policy change, added focused replay-sanitization coverage, and fixed the current-head review concern by preserving real tool results for aborted assistant spans.
Local gate: pnpm test src/agents/pi-embedded-runner/run/attempt.tool-call-normalization.test.ts src/plugins/provider-replay-helpers.test.ts extensions/minimax/index.test.ts src/agents/tool-call-id.test.ts and pnpm check.
Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 4613f12). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup.
aa00724 to
850aa22
Compare
obviyus
left a comment
There was a problem hiding this comment.
Verified the MiniMax replay failure came from strict outbound tool-call ID sanitization leaving orphan tool-result ids like ...toolresult1, and confirmed the landed fix re-runs pairing repair on the send path.
Maintainer follow-up: replaced the original hybrid-toolu_* replay-policy change, added focused replay-sanitization coverage, fixed the review-thread concern by preserving real tool results for aborted assistant spans, and rebased the branch onto latest main.
Local gate: pnpm test src/agents/pi-embedded-runner/run/attempt.tool-call-normalization.test.ts src/plugins/provider-replay-helpers.test.ts extensions/minimax/index.test.ts src/agents/tool-call-id.test.ts and pnpm check.
obviyus
left a comment
There was a problem hiding this comment.
Verified the MiniMax replay failure came from strict outbound tool-call ID sanitization leaving orphan tool-result ids like ...toolresult1, and confirmed the landed fix re-runs pairing repair on the send path.
Maintainer follow-up: replaced the original hybrid-toolu_* replay-policy change, added focused replay-sanitization coverage, fixed the review-thread concern by preserving real tool results for aborted assistant spans, and rebased the branch onto latest main.
Local gate: pnpm test src/agents/pi-embedded-runner/run/attempt.tool-call-normalization.test.ts src/plugins/provider-replay-helpers.test.ts extensions/minimax/index.test.ts src/agents/tool-call-id.test.ts and pnpm check.
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 4613f12). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 4613f12). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 4613f12). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 209daa2). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in ccff69c). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 6450e4b). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 55f96d8). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 95cfbcf). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 643d129). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
… (thanks @stainlu) * fix(agents): preserve native Anthropic tool IDs for hybrid providers Fixes openclaw#66892 MiniMax and other hybrid providers use api.minimaxi.com/anthropic (modelApi: anthropic-messages), which generates and expects native Anthropic tool_call_ids in toolu_* format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) applied strict sanitization that stripped underscores from these IDs, causing MiniMax to reject them with error 2013. The native Anthropic provider already preserved these IDs via preserveNativeAnthropicToolUseIds (added in 4613f12). This commit enables the same flag for the hybrid anthropic-messages branch, so toolu_* IDs pass through unsanitized while other synthetic IDs still get strict cleanup. * fix(agents): repair sanitized replay tool results before send * fix: repair sanitized replay tool results before send (openclaw#67620) (thanks @stainlu) * fix: preserve aborted-span tool results during replay sanitize (openclaw#67620) (thanks @stainlu) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
Summary
api.minimaxi.com/anthropic(modelApi: "anthropic-messages") generate tool_call_ids in Anthropic's nativetoolu_*format. The hybrid replay policy (buildHybridAnthropicOrOpenAIReplayPolicy) appliedtoolCallIdMode: "strict"sanitization that strips ALL non-alphanumeric characters — removing the underscore fromtoolu_01A09q...→toolu01A09q.... MiniMax's endpoint rejects the mangled ID with error 2013 ("tool_call id format is not supported"), triggering a 7-minute auth cooldown and session crash.buildHybridAnthropicOrOpenAIReplayPolicyinsrc/plugins/provider-replay-helpers.tscallsbuildStrictAnthropicReplayPolicywithoutpreserveNativeAnthropicToolUseIds: true. The native Anthropic provider (buildNativeAnthropicReplayPolicyForModel) already sets this flag — the hybrid path was missing it.preserveNativeAnthropicToolUseIds: trueto thebuildStrictAnthropicReplayPolicycall in the hybrid anthropic-messages branch. Nativetoolu_*IDs now pass through unsanitized while other synthetic IDs still get strict cleanup. One-line production change + test updates.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR