Revert "fix(antigravity): Claude 模型透传 tool_use 的 signature"
This reverts commit 81b865b89d.
This commit is contained in:
@@ -389,13 +389,10 @@ func buildParts(content json.RawMessage, toolIDToName map[string]string, allowDu
|
|||||||
ID: block.ID,
|
ID: block.ID,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// tool_use 的 signature 处理:
|
// 只有 Gemini 模型使用 dummy signature
|
||||||
// - Gemini 模型:使用 dummy signature(跳过 thought_signature 校验)
|
// Claude 模型不设置 signature(避免验证问题)
|
||||||
// - Claude 模型:透传上游返回的真实 signature(Vertex/Google 需要完整签名链路)
|
|
||||||
if allowDummyThought {
|
if allowDummyThought {
|
||||||
part.ThoughtSignature = dummyThoughtSignature
|
part.ThoughtSignature = dummyThoughtSignature
|
||||||
} else if block.Signature != "" && block.Signature != dummyThoughtSignature {
|
|
||||||
part.ThoughtSignature = block.Signature
|
|
||||||
}
|
}
|
||||||
parts = append(parts, part)
|
parts = append(parts, part)
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ func TestBuildParts_ToolUseSignatureHandling(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Claude model - preserve valid signature for tool_use", func(t *testing.T) {
|
t.Run("Claude model - no signature for tool_use", func(t *testing.T) {
|
||||||
toolIDToName := make(map[string]string)
|
toolIDToName := make(map[string]string)
|
||||||
parts, _, err := buildParts(json.RawMessage(content), toolIDToName, false)
|
parts, _, err := buildParts(json.RawMessage(content), toolIDToName, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -123,9 +123,9 @@ func TestBuildParts_ToolUseSignatureHandling(t *testing.T) {
|
|||||||
if len(parts) != 1 || parts[0].FunctionCall == nil {
|
if len(parts) != 1 || parts[0].FunctionCall == nil {
|
||||||
t.Fatalf("expected 1 functionCall part, got %+v", parts)
|
t.Fatalf("expected 1 functionCall part, got %+v", parts)
|
||||||
}
|
}
|
||||||
// Claude 模型应透传有效的 signature(Vertex/Google 需要完整签名链路)
|
// Claude 模型不设置 signature
|
||||||
if parts[0].ThoughtSignature != "sig_tool_abc" {
|
if parts[0].ThoughtSignature != "" {
|
||||||
t.Fatalf("expected preserved tool signature %q, got %q", "sig_tool_abc", parts[0].ThoughtSignature)
|
t.Fatalf("expected no tool signature for Claude, got %q", parts[0].ThoughtSignature)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user