feat(anthropic-adapter): preserve unsigned thinking blocks on MiniMax round-trip - #24494
Conversation
|
Thanks for identifying the MiniMax replay path. Current main still strips its unsigned thinking blocks, but this stale patch needs a narrow rework before salvage. Problems
Suggested changes
Automated hermes-sweeper review. |
|
Thanks for the detailed review. You're right that the branch is stale. I'll rework it against current |
2c8c44e to
75bf4d8
Compare
Reuse the existing MiniMax-only endpoint predicate in thinking signature management so both global and China endpoints preserve unsigned reasoning_content-derived blocks while stripping Anthropic-signed blocks. Replace the outdated MiniMax strip-all regression with an Azure negative case and add direct coverage for both MiniMax hosts.
75bf4d8 to
04aab97
Compare
|
Reworked and pushed in |
Summary
MiniMax's Anthropic-compatible endpoints require unsigned thinking blocks derived from
reasoning_contentto round-trip in replayed assistant tool-call history. Hermes already synthesizes those blocks, but the generic third-party signature-management path removed them on subsequent turns.This PR updates
_manage_thinking_signaturesto reuse the existing_is_minimax_anthropic_endpointpredicate. For both supported MiniMax Anthropic endpoints, Hermes now:reasoning_content;cache_controlfrom retained thinking blocks through the shared cleanup path.Azure remains on the generic third-party strip-all path, preventing the broader Bearer-auth matcher from accidentally opting Azure into MiniMax behavior.
Endpoints covered
https://api.minimax.io/anthropichttps://api.minimaxi.com/anthropicTests
Added direct regression coverage showing that both MiniMax hosts:
The previous MiniMax strip-all assertion was replaced with an Azure negative case.
Validation completed:
scripts/run_tests.sh -j 2 tests/agent/test_minimax_anthropic_thinking.py tests/agent/test_deepseek_anthropic_thinking.py— 13 passedruff check agent/anthropic_adapter.py tests/agent/test_deepseek_anthropic_thinking.py tests/agent/test_minimax_anthropic_thinking.py— passedpython -m py_compile agent/anthropic_adapter.py tests/agent/test_deepseek_anthropic_thinking.py tests/agent/test_minimax_anthropic_thinking.py— passedReview note
The branch has been rebased onto current
main. The upstream CI workflow is awaiting maintainer approval before jobs can start.