Uh oh!
There was an error while loading. Please reload this page.
fix(js/plugins/google-genai): Do not persist clientOptions in the … - #5992
Conversation
…ration for long running models
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to apply connection-related overrides (such as apiKey, apiVersion, baseUrl, and location) from the action run context (options.context) to background models like Deep Research and Veo. This replaces the previous approach of persisting client options in the operation's metadata. The changes span both the Google AI and Vertex AI plugins, including updates to their respective utility functions, model definitions, and tests. A minor issue was found in the Vertex AI Veo tests where a redundant double await statement is used.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Introduce `OperationOptions` type with a `toRunOptions` helper to allow passing config overrides and secrets when checking or cancelling background operations. This replaces the previous `BackgroundActionRunOptions` usage in `checkOperation` and `cancelOperation`, enabling critical configuration (e.g. `baseUrl`) and secrets (e.g. `apiKey`) to be supplied at call time.
Update the veo-photo-move-location-override flow to pass location via config overrides instead of context.location. On generate(), config overrides ride in context.config, while checkOperation() takes them in the top-level `config` field. Update comments to reflect the correct override mechanism.
Surface RAI filter reasons as an error when every generated video is removed by safety filters, instead of throwing on the missing `videos` array. Mark `videos` as optional in the VeoOperation type and set the finish reason to 'blocked' when content is filtered.
Use logical OR instead of nullish coalescing to fall back to the default error message when raiMediaFilteredReasons is an empty string, ensuring a meaningful message is always surfaced.
operation for long running models
This is a breaking change for certain edge cases involving background models with per request overrides only.
Previously the clientOptions were persisted in the operation metadata so it was easier to poll using the same information, however apparently people were just returning the full operation including auth to untrusted third parties without any modification, so there was a potential for leaking apiKeys if they did not remove the metadata from the operation first. This implementation removes that leak potential for security purposes and the operation no longer persists any client options passed in to the original generate request. Unfortunately this breaks an edge case that previously worked: If any overrides were present for longrunning models (such as apiKeys), previously it just worked, but now those overrides must also be passed in for each checkOperation or cancelOperation.
Checklist (if applicable):