Skip to content

fix: preserve empty GCS text artifacts#5724

Open
pragnyanramtha wants to merge 7 commits into
google:mainfrom
pragnyanramtha:pragnyan/gcs-empty-text-artifacts
Open

fix: preserve empty GCS text artifacts#5724
pragnyanramtha wants to merge 7 commits into
google:mainfrom
pragnyanramtha:pragnyan/gcs-empty-text-artifacts

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • allow GcsArtifactService to save Part(text="") as a valid text artifact
  • load GCS blobs via get_blob() so missing objects are distinct from zero-byte objects
  • add regression coverage for saving and loading an empty GCS text artifact

Context

The file artifact backend already persists empty text artifacts, but the GCS backend checked artifact.text by truthiness and rejected empty strings as missing payloads. It also treated download_as_bytes() == b"" as a missing artifact, which collapses a valid zero-byte GCS object into None.

This keeps the existing GCS retrieval shape for text artifacts: they load as inline_data with text/plain, matching current non-empty text behavior.

Validation

  • uv run --extra test pytest tests/unittests/artifacts/test_artifact_service.py -q -> 60 passed
  • uv run --extra dev pyink --check src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.py -> passed
  • uv run --extra dev isort --check-only src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.py -> passed
  • python3 -m py_compile src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.py -> passed
  • git diff --check -> passed

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 16, 2026 21:01
@rohityan rohityan self-assigned this May 18, 2026
@rohityan rohityan added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label May 18, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @pragnyanramtha , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan rohityan added the needs review [Status] The PR/issue is awaiting review from the maintainer label May 18, 2026
@rohityan rohityan requested a review from sasha-gitg May 18, 2026 21:48
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @sasha-gitg , can you review this. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review [Status] The PR/issue is awaiting review from the maintainer services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants