File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -384,6 +384,12 @@ export function createGoogleAdapter(provider: OcxProviderConfig): ProviderAdapte
384384 const draftRequest : Record < string , unknown > = { ...body , sessionId } ;
385385 // Claude-on-Antigravity forces VALIDATED function calling (the real client always sets it).
386386 if ( / c l a u d e / i. test ( wireModelId ) ) {
387+ // VALIDATED would defeat a client's tool_choice "none": honor it by dropping the
388+ // declarations instead, the wire shape of a tool-less Claude turn.
389+ if ( parsed . options . toolChoice === "none" ) {
390+ delete draftRequest . tools ;
391+ delete draftRequest . toolConfig ;
392+ }
387393 const existing = ( draftRequest . toolConfig ?? { } ) as Record < string , unknown > ;
388394 const fcc = ( existing . functionCallingConfig ?? { } ) as Record < string , unknown > ;
389395 draftRequest . toolConfig = { ...existing , functionCallingConfig : { ...fcc , mode : "VALIDATED" } } ;
Original file line number Diff line number Diff line change @@ -238,6 +238,28 @@ describe("google adapter — tool_choice on the wire", () => {
238238 expect ( ( await geminiBody ( parsedWithChoice ( { name : "get_weather" } , [ ] ) ) ) . toolConfig ) . toBeUndefined ( ) ;
239239 } ) ;
240240
241+ test ( 'claude-on-antigravity honors "none" by dropping the declarations' , async ( ) => {
242+ const ccaProvider = {
243+ adapter : "google" ,
244+ googleMode : "cloud-code-assist" ,
245+ baseUrl : "https://daily-cloudcode-pa.googleapis.com" ,
246+ apiKey : "key" ,
247+ project : "proj-123" ,
248+ } ;
249+ const claudeParsed = parsedWithChoice ( "none" ) ;
250+ ( claudeParsed as unknown as { modelId : string } ) . modelId = "claude-opus-4.8" ;
251+ const claudeRequest = JSON . parse ( ( await createGoogleAdapter ( ccaProvider ) . buildRequest ( claudeParsed ) ) . body ) . request as Record < string , unknown > ;
252+ // VALIDATED would defeat NONE, so the declarations go instead; the config matches a tool-less turn.
253+ expect ( claudeRequest . tools ) . toBeUndefined ( ) ;
254+ expect ( claudeRequest . toolConfig ) . toEqual ( { functionCallingConfig : { mode : "VALIDATED" } } ) ;
255+
256+ // Gemini on the same route has no VALIDATED override, so NONE rides with the catalog intact.
257+ const geminiParsed = parsedWithChoice ( "none" ) ;
258+ const geminiRequest = JSON . parse ( ( await createGoogleAdapter ( ccaProvider ) . buildRequest ( geminiParsed ) ) . body ) . request as Record < string , unknown > ;
259+ expect ( geminiRequest . tools ) . toBeDefined ( ) ;
260+ expect ( geminiRequest . toolConfig ) . toEqual ( { functionCallingConfig : { mode : "NONE" } } ) ;
261+ } ) ;
262+
241263 test ( "claude-on-antigravity keeps VALIDATED mode over a client choice, allowed names survive" , async ( ) => {
242264 const ccaProvider = {
243265 adapter : "google" ,
You can’t perform that action at this time.
0 commit comments