Conversation
Forward the persisted creation time when returning file artifact version metadata so repeated get and list calls do not assign a new creation time. Keep the existing fallback when metadata is unavailable.
copybara-service Bot
pushed a commit
that referenced
this pull request
Sep 15, 2026
Merge #7113 PiperOrigin-RevId: 982032909
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
FileArtifactServicesaves the correctcreateTimeto disk, but_build_artifact_version()omits it when constructing the returned metadata.The
ArtifactVersiondefault then assigns the current time on every read,so the same saved version appears newly created each time it is fetched.
This change forwards the persisted timestamp in the helper shared by
get_artifact_version()andlist_artifact_versions(). It preserves theexisting fallback for unavailable metadata, canonical URI validation, and
custom metadata copying.
Reproduction
On main at
460715b6c62c8e9ab00931c502381ee0364e39b6, save an artifact,reopen the service, and read the same version repeatedly:
Expected: each read returns the persisted creation time. Before the fix, the
timestamps differ and the assertion fails. With the fix, it passes.
Reproduced on macOS 26.6.2 arm64, Python 3.12.10, ADK 2.9.0,
google-genai 2.23.0 and Pydantic 2.13.5. No model or LiteLLM is involved.
Testing Plan
Regression and affected callers: the new regression fails before the fix
and passes afterward. It covers distinct save/read times, a zero timestamp,
reopening, multiple versions, session/user scopes, and text/binary payloads.
The artifact, Context, forwarding service, local storage, FastAPI, and
save-files plugin tests report 1,142 passed, 5 skipped, 1 xfailed.
Full unit suite via tox:
The two Python 3.12 failures are the agent/runner import-allowlist tests
detecting Homebrew's preloaded
sitecustomize; both fail identically onunchanged main with the same interpreter. Overall tox exits with code 1.
The test process excludes
gcloudfrom PATH to prevent interactive login;an unrelated CLI test's interactive option flow remains unverified.
Formatting and types: full pre-commit passed. The optional
addlicensebinary was unavailable, so that check was skipped. Mypy reports the same
847 errors before and after the change, with no new diagnostics.
End-to-end: built the wheel, installed it in a clean environment, and
verified the public API and actual
adk webHTTP routes using file artifactstorage and in-memory sessions/memory. Save/get/get/list all return HTTP 200.
The returned timestamps now match the persisted value:
Missing, malformed, legacy missing-time, and invalid-time metadata retain
their previous fallback behavior. These checks pass before and after the fix.