Skip to content

fix(artifacts): preserve inline display names#5914

Open
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/artifact-display-name-roundtrip
Open

fix(artifacts): preserve inline display names#5914
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/artifact-display-name-roundtrip

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

FileArtifactService and GcsArtifactService currently preserve the bytes and MIME type of inline_data artifacts, but drop inline_data.display_name on load. That leaves downstream converters without the user-facing filename even when the caller provided one.

This stores the display name alongside the artifact payload and restores it when loading binary artifacts:

  • file-backed artifacts persist it in the per-version metadata JSON
  • GCS-backed artifacts store it in an internal blob metadata key
  • user-supplied custom_metadata remains unchanged when artifact version metadata is listed or fetched

Fixes #5833.

Tested

  • PYTHONPATH=src python -m pytest tests/unittests/artifacts/test_artifact_service.py::test_save_load_preserves_inline_data_display_name -q
  • PYTHONPATH=src python -m py_compile src/google/adk/artifacts/file_artifact_service.py src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.py
  • python -m pyink --check src/google/adk/artifacts/file_artifact_service.py src/google/adk/artifacts/gcs_artifact_service.py tests/unittests/artifacts/test_artifact_service.py
  • git diff --check

I also ran the full artifact-service test file locally with PYTHONPATH=src. It passed all GCS/in-memory/display-name cases, with two existing Windows-only failures in tests that parse file:///C:/... URIs back with Path(unquote(parsed.path)), producing /C:/...; those are unrelated to this change.

pre-commit run --files ... passed the format/import hooks, but the two repository-local bash hooks could not run on this Windows checkout because /bin/bash is unavailable.

@adk-bot adk-bot added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Blob.display_name not preserved when loading binary artifacts from FileArtifactService / GcsArtifactService

2 participants