VertexAiSessionService: Event.id differs between the streamed event and getSession (id is not sent to Vertex and the appendEvent response is empty)
Les mainteneurs répondent en général sous 1 jour
@hemasekhar-p y travaille déjà.
Depuis le 13/10/2026.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Start with VertexAiSessionService.appendEvent and SessionJsonConverter in com.google.adk.sessions, then compare event serialization with the Python fix linked in the issue. Check how the REST rawEvent field can preserve the ADK id and how session loading chooses an id. Done means the streamed event and the event returned by getSession retain the same id, with tests covering the round trip.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
With VertexAiSessionService, the same logical event has two different ids depending on how it is observed:
| Observed via | Event.id |
|---|---|
Runner.runAsync(...) stream |
ADK-generated UUID (Event.generateEventId()) |
getSession(...) afterwards |
Vertex resource id (last segment of the event name) |
InMemorySessionService keeps the ADK UUID, so the two services behave differently and the problem does not show up in local development.
Where (checked on 1.8.0 and 1.10.1)
BaseLlmFlowcreates the id withEvent.generateEventId()(a random UUID) and resets it for each resulting event.Runner.runAsynccallssessionService.appendEvent(session, event)for every non-partial event, then emits the event to the caller.VertexAiSessionService.appendEventsendsSessionJsonConverter.convertEventToJson(e)to:appendEvent. That JSON containsauthor,invocationId,timestamp,actions,eventMetadataandcontent, but no event id, and norawEvent(there is no reference torawEventanywhere incom.google.adk.sessionsin these versions).VertexAiClient.appendEventonly checks the response body forClientExceptionand returnsCompletable.complete().VertexAiSessionService.appendEventthen returns the local event (.toSingleDefault(e)), so the caller keeps the ADK UUID.- On
getSession,SessionJsonConverterrebuilds the id from the API resource name:
.id(Iterables.getLast(Splitter.on('/').split(apiEvent.get("name").toString())))
What the API allows
From the SessionEvent REST reference:
nameis documented as "Identifier. The resource name of the event" (…/sessions/{session}/events/{event}). There is no other field meant to carry a client-assigned event id.rawEventis "Optional. Weakly typed raw event data in proto struct format."sessions.appendEventreturns an empty body on success, so the id created by the service is not available at append time.
Documentation
The Events documentation says that the session service "records the event as it received it" (in the Python description) and recommends using event.id to reference specific occurrences. This does not hold for VertexAiSessionService: the id seen during the run is never stored and is replaced on reload.
Impact
Anything that correlates a streamed event with its persisted form by Event.id breaks. In our case (a chat UI built on top of an AG-UI endpoint), message ids sent to the client while streaming do not match the ids returned when the conversation is reloaded, so per-message state (for example feedback) can be attached to an id that no longer exists. The only workaround we found is to reload the session after the run and pair events by invocationId and order while checking the text, which is fragile.
Expected behavior
One of:
- Persist the ADK id (for example in
rawEvent, as ADK Python now does) and prefer it over the resource name when reading; or - Make the id assigned by Vertex available to the caller at append time (not possible today since the response is empty); or
- If neither is possible, document that
Event.idis not stable across streaming and reload on this service.
Related
- google/adk-python#6530: same behavior in Python, closed as a bug and fixed by keeping the id stored in
raw_event(commit 864914b). The Java converter does not writerawEvent, so that fix does not port directly. - google/adk-go#1329: same behavior in Go (open), noting that
SessionEventhas no field for a client event id.
Environment
google-adk1.8.0 (the same code is present in 1.10.1)VertexAiSessionServiceon Vertex AI Agent Engine sessions
- Langage dominant
- Java
- Étoiles
- 1.7k
- Forks
- 433
- Merge moyen
- 2 j 23 h
- PR mergées (30 j)
- 52
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de google/adk-java
-
GeminiUtil placeholder user turn ("Continue output. DO NOT look at this line ...") is flagged by prompt injection filtersPeut-être pris @hemasekhar-p l’a pris il y a 6 jours. Ouverteneeds review
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
google/adk-java#1628 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[spring-ai] Streaming responses ending with CJK punctuation (。!?) are misclassified as partial and never persisted to the sessionPeut-être pris @hirematha l’a pris il y a 9 jours. Ouverteneeds review
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
google/adk-java#1608 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
runLive passes partial events to appendEvent and never aggregates text chunks, unlike ADK PythonPeut-être pris @hemasekhar-p l’a pris il y a 2 jours. Ouverteneeds review
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
google/adk-java#1648 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
FirestoreSessionService compares event timestamps as text, reordering or skipping same-second eventsPeut-être pris @hemasekhar-p l’a pris il y a 2 jours. Ouverteneeds review
Difficulté 3/5 1-2 jours Accessibilité débutants 50/100
google/adk-java#1646 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
FirestoreSessionService ignores `app:` / `user:` state prefixes, so app and user state are never shared across sessionsPeut-être pris @hemasekhar-p l’a pris il y a 2 jours. Ouvertewaiting on reporter
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
google/adk-java#1645 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de google/adk-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
NationalSecurityAgency/ghidra#9884 ·
Les mainteneurs répondent en général sous 2 jours
-
Status: Pending Review Type: Feature Request
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
OpenRefine/OpenRefine#8019 ·
Les mainteneurs répondent en général sous 1 jour
-
`timer` rule rejects dates the engine acceptsPeut-être pris @MFA-G l’a pris aujourd’hui. Ouvertebug ready
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
camunda/bpmnlint-plugin-camunda-compat#281 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
status: waiting-for-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100