Skip to content

fix(anthropic): keep MiniMax thinking blocks on replay - #76865

Open
ahinks wants to merge 1 commit into
NousResearch:mainfrom
ahinks:fix/minimax-thinking-replay
Open

fix(anthropic): keep MiniMax thinking blocks on replay#76865
ahinks wants to merge 1 commit into
NousResearch:mainfrom
ahinks:fix/minimax-thinking-replay

Conversation

@ahinks

@ahinks ahinks commented Aug 2, 2026

Copy link
Copy Markdown

Problem

MiniMax's /anthropic endpoints were classified as generic third-party in _manage_thinking_signatures, so ALL thinking blocks were stripped from every replayed assistant turn. The model's prior chain of thought silently disappeared between turns and inside tool loops, breaking interleaved reasoning on multi-turn agentic work after the 2nd or 3rd turn. Same bug class as the Kimi fix in #13848 / ddd81e9, which MiniMax was left out of.

Evidence (live probe, 2026-08-01, MiniMax-M3 via api.minimax.io/anthropic)

  • Turn 1 returns a signed thinking block (64-char signature)
  • Replay verbatim (signed block included): HTTP 200
  • Replay stripped: HTTP 200
  • Replay with content-mutated thinking, stale signature: HTTP 200

MiniMax does not enforce thinking signatures at all, so the strip was pure loss, no 400 protection.

Fix

Replay MiniMax thinking blocks as-is, mirroring the Kimi family rule. Two files:

  • agent/anthropic_adapter.py: add _is_minimax_anthropic_endpoint branch to _manage_thinking_signatures (pass-through), update the docstring
  • tests/agent/test_anthropic_minimax_thinking_replay.py: new, pins both MiniMax endpoints (io + cn) and the interleaved tool-loop turn

Verification

12/12 tests pass: new MiniMax suite (3), Kimi replay suite (3), DeepSeek thinking (3), thinking block order (3).

MiniMax /anthropic endpoints accept signed thinking blocks verbatim or
mutated (live-probed 2026-08-01, HTTP 200 both ways), so the third-party
strip-all path was dropping prior chain-of-thought and breaking interleaved
reasoning on multi-turn and tool-loop work. Replay as-is like Kimi.
Add tests pinning both MiniMax endpoints plus the interleaved tool turn.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/minimax MiniMax (Anthropic transport) P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation labels Aug 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #75748 and #66694 address the same MiniMax replay family. This patch preserves signed thinking blocks verbatim, whereas #75748 normalizes them unsigned; this is a replay-contract decision, not a duplicate.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracing the current replay path. The current-main premise is verified: agent/anthropic_adapter.py:2490-2493 classifies MiniMax as third-party, and agent/anthropic_adapter.py:2521-2528 strips its replayed thinking blocks. The proposed branch correctly reuses the existing MiniMax-only predicate.

Problems

  • The new pass branch applies to redacted_thinking too: _THINKING_TYPES includes it at agent/anthropic_adapter.py:2487, but tests/agent/test_anthropic_minimax_thinking_replay.py covers only normal thinking blocks. Please establish the MiniMax contract for replaying redacted_thinking.data, or handle it conservatively.
  • The signed-block policy needs maintainer consolidation. Open #75748 changes the same branch to demote signatures, while this PR preserves them verbatim; the MEMBER discussion identifies this as a replay-contract decision.

Suggested changes

  • Select one signed-thinking replay policy and consolidate the related MiniMax PRs around it.
  • Add a redacted-thinking regression case if verbatim replay is intended.

Automated hermes-sweeper review.

@@ -2518,6 +2520,13 @@ def _manage_thinking_signatures(
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pass-through also preserves redacted_thinking blocks and their opaque data payloads because _THINKING_TYPES includes that subtype, but the new tests only exercise ordinary thinking blocks. Please add a MiniMax replay contract test for redacted_thinking, or limit the carve-out until that payload behavior is verified.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have provider/minimax MiniMax (Anthropic transport) sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants