Repository navigation
fix(anthropic): 같은 tool_use id 를 한 번만 싣는다 (4.107.1) - #182
Merged
Merged
Conversation
… unique" (4.107.1) Agent-Geny 에서 claude-sonnet-5-5 를 쓰면 턴이 400 "messages.3.content.2: tool_use ids must be unique" 로 끝났다. 같은 id 의 tool_use 가 두 번 실린 응답은 도구를 두 번 돌리고, 기록에 남아 그 세션의 이후 턴도 모두 같은 400 을 맞는다. - 응답을 읽을 때(AnthropicClient·BedrockClient·AnthropicProvider): 같은 id 는 한 번만 받고, 입력이 있는 쪽을 남긴다. 이런 응답이 오면 모델 · stop_reason · 블록 종류를 경고 로그로 남긴다. SDK 의 스트림 조립은 content_block_start 마다 블록을 덧붙여서, 같은 블록의 시작이 두 번 오면 이 모양이 된다(테스트가 SDK 코드로 재현한다). - 요청을 보낼 때(normalize_messages_for_request): 같은 id 의 tool_use · tool_result 는 처음 것만 싣는다. 저장된 기록은 그대로라 이미 중복이 저장된 세션도 다음 턴부터 이어진다. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇을
Agent-Geny 에서
claude-sonnet-5-5를 쓰면 턴이 400messages.3.content.2: tool_use ids must be unique로 끝났다. 두 곳에서 막는다.AnthropicClient·BedrockClient·AnthropicProvider의_parse_response): 같은 id 의tool_use는 한 번만 받는다. 처음 것의 입력이 비었으면 나중 것의 입력을 쓴다. 이런 응답이 오면 모델 · stop_reason · 블록 종류를 경고 로그로 남긴다.normalize_messages_for_request): 기록 전체에서 같은 id 의tool_use·tool_result는 처음 것만 싣는다. 저장된 기록은 건드리지 않는다.SDK(0.125.0, 최신 2.6.0 도 같다)의
accumulate_event는content_block_start마다 블록을 덧붙인다(# TODO: check index). 같은 블록의 시작이 두 번 오면 같은 id 의 블록이 둘이 되고 입력은 처음 것에만 채워진다. 테스트가 SDK 코드로 이것을 재현한다. 실제 API 가 이렇게 보냈는지는 실패한 요청 원문이 없어 확인하지 못했다. 경고 로그가 그 증거를 남긴다.검증
tests/llm_client/unit/test_anthropic_unique_tool_use.py,tests/unit/test_tool_pair_repair.py::TestRepeatedToolUseIds)test_runtime_tasks.py::test_old_stage_module_is_gone)은 main 에서도 같다🤖 Generated with Claude Code