Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
81b865b8
Commit
81b865b8
authored
Jan 03, 2026
by
ianshaw
Browse files
fix(antigravity): Claude 模型透传 tool_use 的 signature
- Vertex/Google API 需要完整签名链路 - Claude 模型不再清空 tool_use 的 signature
parent
b0d41823
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/pkg/antigravity/request_transformer.go
View file @
81b865b8
...
...
@@ -240,10 +240,13 @@ func buildParts(content json.RawMessage, toolIDToName map[string]string, allowDu
ID
:
block
.
ID
,
},
}
// 只有 Gemini 模型使用 dummy signature
// Claude 模型不设置 signature(避免验证问题)
// tool_use 的 signature 处理:
// - Gemini 模型:使用 dummy signature(跳过 thought_signature 校验)
// - Claude 模型:透传上游返回的真实 signature(Vertex/Google 需要完整签名链路)
if
allowDummyThought
{
part
.
ThoughtSignature
=
dummyThoughtSignature
}
else
if
block
.
Signature
!=
""
&&
block
.
Signature
!=
dummyThoughtSignature
{
part
.
ThoughtSignature
=
block
.
Signature
}
parts
=
append
(
parts
,
part
)
...
...
backend/internal/pkg/antigravity/request_transformer_test.go
View file @
81b865b8
...
...
@@ -103,7 +103,7 @@ func TestBuildParts_ToolUseSignatureHandling(t *testing.T) {
}
})
t
.
Run
(
"Claude model -
no
signature for tool_use"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"Claude model -
preserve valid
signature for tool_use"
,
func
(
t
*
testing
.
T
)
{
toolIDToName
:=
make
(
map
[
string
]
string
)
parts
,
err
:=
buildParts
(
json
.
RawMessage
(
content
),
toolIDToName
,
false
)
if
err
!=
nil
{
...
...
@@ -112,9 +112,9 @@ func TestBuildParts_ToolUseSignatureHandling(t *testing.T) {
if
len
(
parts
)
!=
1
||
parts
[
0
]
.
FunctionCall
==
nil
{
t
.
Fatalf
(
"expected 1 functionCall part, got %+v"
,
parts
)
}
// Claude 模型
不设置
signature
if
parts
[
0
]
.
ThoughtSignature
!=
""
{
t
.
Fatalf
(
"expected
no
tool signature
for Claude, got %q
"
,
parts
[
0
]
.
ThoughtSignature
)
// Claude 模型
应透传有效的
signature
(Vertex/Google 需要完整签名链路)
if
parts
[
0
]
.
ThoughtSignature
!=
"
sig_tool_abc
"
{
t
.
Fatalf
(
"expected
preserved
tool signature
%q, got %q"
,
"sig_tool_abc
"
,
parts
[
0
]
.
ThoughtSignature
)
}
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment