fix(antigravity): opus 4.6 forward-compat model + thinking signature sanitization bypass (#14218)

Two fixes for Google Antigravity (Cloud Code Assist) reliability:

1. Forward-compat model fallback: pi-ai's model registry doesn't include
   claude-opus-4-6-thinking. Add resolveAntigravityOpus46ForwardCompatModel()
   that clones the opus-4-5 template so the correct api ("google-gemini-cli")
   and baseUrl are preserved. Fixes #13765.

2. Fix thinking.signature rejection: The API returns Claude thinking blocks
   without signatures, then rejects them on replay. The existing sanitizer
   strips unsigned blocks, but the orphaned-user-message path in attempt.ts
   bypassed it by reading directly from disk. Now applies
   sanitizeAntigravityThinkingBlocks at that code path.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jg-noncelogic
2026-02-12 09:01:28 -05:00
committed by GitHub
parent d85150357f
commit 6f74786384
4 changed files with 84 additions and 2 deletions

View File

@@ -207,6 +207,41 @@ describe("resolveModel", () => {
});
});
it("builds a google-antigravity forward-compat fallback for claude-opus-4-6-thinking", () => {
const templateModel = {
id: "claude-opus-4-5-thinking",
name: "Claude Opus 4.5 Thinking",
provider: "google-antigravity",
api: "google-gemini-cli",
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
reasoning: true,
input: ["text", "image"] as const,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 64000,
};
vi.mocked(discoverModels).mockReturnValue({
find: vi.fn((provider: string, modelId: string) => {
if (provider === "google-antigravity" && modelId === "claude-opus-4-5-thinking") {
return templateModel;
}
return null;
}),
} as unknown as ReturnType<typeof discoverModels>);
const result = resolveModel("google-antigravity", "claude-opus-4-6-thinking", "/tmp/agent");
expect(result.error).toBeUndefined();
expect(result.model).toMatchObject({
provider: "google-antigravity",
id: "claude-opus-4-6-thinking",
api: "google-gemini-cli",
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
reasoning: true,
});
});
it("keeps unknown-model errors for non-gpt-5 openai-codex ids", () => {
const result = resolveModel("openai-codex", "gpt-4.1-mini", "/tmp/agent");
expect(result.model).toBeUndefined();