Skip to content

fix: preserve empty GCS text artifacts#5724

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

fix: preserve empty GCS text artifacts#5724
pragnyanramtha wants to merge 1 commit 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
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