Skip to content

fix(js/plugins/google-genai): Do not persist clientOptions in the … - #5992

Merged
pavelgj merged 7 commits into
mainfrom
if-fixPolling
Aug 10, 2026
Merged

fix(js/plugins/google-genai): Do not persist clientOptions in the …#5992
pavelgj merged 7 commits into
mainfrom
if-fixPolling

Conversation

@ifielker

Copy link
Copy Markdown
Collaborator

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):

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment threadjs/plugins/google-genai/tests/vertexai/veo_test.ts Outdated
@ifielkerifielker changed the title fix!(js/plugins/google-genai): Do not persist clientOptions in the …fix(js/plugins/google-genai): Do not persist clientOptions in the …Aug 7, 2026
Comment threadjs/plugins/google-genai/src/googleai/utils.ts Outdated
Ingrid Fielkerand others added 5 commits August 7, 2026 20:20
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.
@pavelgj
pavelgj merged commit 074dbd0 into mainAug 10, 2026
13 checks passed
@pavelgj
pavelgj deleted the if-fixPolling branch August 10, 2026 23:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ifielker@pavelgj