mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:01:22 +00:00
fix: clean tool schemas and thinking blocks for google-antigravity (openclaw#19732) thanks @Oceanswave
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Oceanswave <760674+Oceanswave@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -91,7 +91,7 @@ describe("sanitizeSessionHistory (google thinking)", () => {
|
||||
expect(assistant.content?.[0]?.thinking).toBe("reasoning");
|
||||
});
|
||||
|
||||
it("drops unsigned thinking blocks for Antigravity Claude", async () => {
|
||||
it("converts unsigned thinking blocks to text for Antigravity Claude", async () => {
|
||||
const out = await sanitizeSimpleSession({
|
||||
modelApi: "google-antigravity",
|
||||
modelId: "anthropic/claude-3.5-sonnet",
|
||||
@@ -99,8 +99,10 @@ describe("sanitizeSessionHistory (google thinking)", () => {
|
||||
content: [{ type: "thinking", thinking: "reasoning" }],
|
||||
});
|
||||
|
||||
const assistant = out.find((msg) => (msg as { role?: string }).role === "assistant");
|
||||
expect(assistant).toBeUndefined();
|
||||
const assistant = out.find((msg) => (msg as { role?: string }).role === "assistant") as {
|
||||
content?: Array<{ type?: string; text?: string }>;
|
||||
};
|
||||
expect(assistant.content).toEqual([{ type: "text", text: "reasoning" }]);
|
||||
});
|
||||
|
||||
it("maps base64 signatures to thinkingSignature for Antigravity Claude", async () => {
|
||||
|
||||
@@ -101,6 +101,12 @@ export function sanitizeAntigravityThinkingBlocks(messages: AgentMessage[]): Age
|
||||
const candidate =
|
||||
rec.thinkingSignature ?? rec.signature ?? rec.thought_signature ?? rec.thoughtSignature;
|
||||
if (!isValidAntigravitySignature(candidate)) {
|
||||
// Preserve reasoning content as plain text when signatures are invalid/missing.
|
||||
// Antigravity Claude rejects unsigned thinking blocks, but dropping them loses context.
|
||||
const thinkingText = (block as { thinking?: unknown }).thinking;
|
||||
if (typeof thinkingText === "string" && thinkingText.trim()) {
|
||||
nextContent.push({ type: "text", text: thinkingText } as AssistantContentBlock);
|
||||
}
|
||||
contentChanged = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user