Repository navigation
minimax: disable tool call ID sanitization for Anthropic-compatible API - #65371
sebykrueger wants to merge 2 commits into
Conversation
Greptile SummaryDisables tool call ID sanitization on MiniMax's Anthropic-compatible API path ( Confidence Score: 5/5Safe to merge; the fix is correct and all remaining findings are P2 style suggestions. The sanitization gate at the call site (sanitizeToolCallIds && toolCallIdMode) ensures the leftover toolCallIdMode: "strict" is inert when sanitizeToolCallIds is false. Both provider registrations are updated. Only P2 concerns remain: duplicated logic that could be a shared helper, and a missing test for the portal + anthropic-messages combination. No files require special attention.
|
| buildReplayPolicy: (ctx) => { | ||
| const base = HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS.buildReplayPolicy?.(ctx); | ||
| if (!base) { | ||
| return base; | ||
| } | ||
| if (ctx.modelApi === "anthropic-messages") { | ||
| return { ...base, sanitizeToolCallIds: false }; | ||
| } | ||
| return base; | ||
| }, |
There was a problem hiding this comment.
Duplicated
buildReplayPolicy override block
The same 13-line block appears verbatim for both minimax and minimax-portal. The extensions/CLAUDE.md guide says: "If two bundled providers share the same replay policy shape … stop copying the logic. Extract one shared helper and migrate both call sites in the same change." Consider extracting this into a module-level helper, e.g.:
function buildMinimaxAnthropicReplayPolicy(ctx: ProviderReplayPolicyContext) {
const base = HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS.buildReplayPolicy?.(ctx);
if (!base) return base;
if (ctx.modelApi === "anthropic-messages") {
return { ...base, sanitizeToolCallIds: false };
}
return base;
}and reference it in both provider registrations as buildReplayPolicy: buildMinimaxAnthropicReplayPolicy.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/minimax/provider-registration.ts
Line: 247-256
Comment:
**Duplicated `buildReplayPolicy` override block**
The same 13-line block appears verbatim for both `minimax` and `minimax-portal`. The `extensions/CLAUDE.md` guide says: "If two bundled providers share the same replay policy shape … stop copying the logic. Extract one shared helper and migrate both call sites in the same change." Consider extracting this into a module-level helper, e.g.:
```ts
function buildMinimaxAnthropicReplayPolicy(ctx: ProviderReplayPolicyContext) {
const base = HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS.buildReplayPolicy?.(ctx);
if (!base) return base;
if (ctx.modelApi === "anthropic-messages") {
return { ...base, sanitizeToolCallIds: false };
}
return base;
}
```
and reference it in both provider registrations as `buildReplayPolicy: buildMinimaxAnthropicReplayPolicy`.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a72a8572ca
ℹ️ 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".
| if (!isWebSocketUrl(cdpUrl) && isLoopbackCdpUrl(cdpUrl)) { | ||
| return await isChromeReachableLoopback(cdpUrl, timeoutMs); | ||
| } |
There was a problem hiding this comment.
Restore SSRF gating for loopback CDP probes
This new early return skips assertCdpEndpointAllowed for loopback HTTP URLs, so a strict policy like dangerouslyAllowPrivateNetwork: false no longer blocks reachable 127.0.0.1/localhost CDP endpoints. The same bypass is mirrored in isChromeCdpReady through the loopback helper path, which makes policy enforcement inconsistent and allows connections that were previously denied under strict SSRF settings.
Useful? React with 👍 / 👎.
| return new Promise<boolean>((resolve) => { | ||
| const versionUrl = appendCdpPath(cdpUrl, "/json/version"); | ||
| const parsed = new URL(versionUrl); | ||
| const req = http.get( |
There was a problem hiding this comment.
Handle HTTPS loopback CDP URLs in raw readiness probes
The loopback probe always uses node:http regardless of the original URL scheme. For https://localhost/https://127.0.0.1 CDP endpoints (which are valid in this codebase), this sends plaintext HTTP to a TLS endpoint and causes false negatives for reachability/readiness, so secure loopback CDP setups regress after this change.
Useful? React with 👍 / 👎.
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.
5bcb3ea to
2b9a055
Compare
|
Closing — superseded by #67967. The original patch was written against the pre-factory replay-hook API; the reworked version wraps |
Summary
buildStrictAnthropicReplayPolicysetssanitizeToolCallIds: truewithtoolCallIdMode: "strict", which rewrites IDs and breaks the roundtripbuildReplayPolicyfor bothminimaxandminimax-portalproviders to setsanitizeToolCallIds: falsewhenmodelApiisanthropic-messagesopenai-completions) keep sanitization unchangedRelated issues
Test plan
pnpm test extensions/minimax/index.test.ts— 6/6 pass (updated expectation forsanitizeToolCallIds: false)pnpm buildpasses