Skip to content

fix(plugins): prevent BQAA offload data loss and preserve binary MIME - #1738

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1011361573
Nov 2, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1011361573

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

fix(plugins): prevent BQAA offload data loss and preserve binary MIME

When gcsBucketName is configured with logMultiModalContent=false, PluginState.getGcsOffloader previously constructed GcsOffloader and Parser.processPart uploaded text exceeding 32 KiB to GCS, replacing summary (content) with a 200-byte "... [OFFLOADED]" stub while BigQueryAgentAnalyticsPlugin wrote content_parts=[], losing both the full inline text and the offloaded GCS URI reference. In addition, Parser.processPart left mime_type="text/plain" on inlineData parts when a GCS upload failed ([UPLOAD FAILED]) and did not normalize an empty "" MIME string to "application/octet-stream".

  • Return null and log a warning in PluginState.getGcsOffloader when !config.logMultiModalContent().
  • Normalize this.offloader = logMultiModalContent ? offloader : null in the Parser constructor so Parser instances with logMultiModalContent=false never offload binary or large-text parts and keep text inline up to maxLength.
  • Normalize blob.mimeType().filter(m -> !m.isEmpty()).orElse("application/octet-stream") and set partBuilder.setMimeType(mimeType) unconditionally in Parser.processPart (CASE B) before attempting GCS upload so [UPLOAD FAILED], [MEDIA OFFLOADED], and [BINARY DATA] parts retain accurate binary MIME metadata.

Aligns with google/adk-python#7868.

@copybara-service
copybara-service Bot force-pushed the test_1011361573 branch 5 times, most recently from bec7ddf to 40927ee Compare November 2, 2026 15:05
When `gcsBucketName` is configured with `logMultiModalContent=false`, `PluginState.getGcsOffloader` previously constructed `GcsOffloader` and `Parser.processPart` uploaded text exceeding 32 KiB to GCS, replacing `summary` (`content`) with a 200-byte `"... [OFFLOADED]"` stub while `BigQueryAgentAnalyticsPlugin` wrote `content_parts=[]`, losing both the full inline text and the offloaded GCS URI reference. In addition, `Parser.processPart` left `mime_type="text/plain"` on `inlineData` parts when a GCS upload failed (`[UPLOAD FAILED]`) and did not normalize an empty `""` MIME string to `"application/octet-stream"`.

- Return `null` and log a warning in `PluginState.getGcsOffloader` when `!config.logMultiModalContent()`.
- Normalize `this.offloader = logMultiModalContent ? offloader : null` in the `Parser` constructor so `Parser` instances with `logMultiModalContent=false` never offload binary or large-text parts and keep text inline up to `maxLength`.
- Normalize `blob.mimeType().filter(m -> !m.isEmpty()).orElse("application/octet-stream")` and set `partBuilder.setMimeType(mimeType)` unconditionally in `Parser.processPart` (`CASE B`) before attempting GCS upload so `[UPLOAD FAILED]`, `[MEDIA OFFLOADED]`, and `[BINARY DATA]` parts retain accurate binary MIME metadata.

Aligns with google/adk-python#7868.

PiperOrigin-RevId: 1012148883
@copybara-service
copybara-service Bot merged commit 94b5bac into main Nov 2, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_1011361573 branch November 2, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant