Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

VertexAiSessionService: Event.id differs between the streamed event and getSession (id is not sent to Vertex and the appendEvent response is empty)

Đang mở
#1,651 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@hemasekhar-p đang làm issue này rồi.

Từ ngày 13/10/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

waiting on reporter
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)
  1. BaseLlmFlow creates the id with Event.generateEventId() (a random UUID) and resets it for each resulting event.
  2. Runner.runAsync calls sessionService.appendEvent(session, event) for every non-partial event, then emits the event to the caller.
  3. VertexAiSessionService.appendEvent sends SessionJsonConverter.convertEventToJson(e) to :appendEvent. That JSON contains author, invocationId, timestamp, actions, eventMetadata and content, but no event id, and no rawEvent (there is no reference to rawEvent anywhere in com.google.adk.sessions in these versions).
  4. VertexAiClient.appendEvent only checks the response body for ClientException and returns Completable.complete(). VertexAiSessionService.appendEvent then returns the local event (.toSingleDefault(e)), so the caller keeps the ADK UUID.
  5. On getSession, SessionJsonConverter rebuilds 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:

  • name is 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.
  • rawEvent is "Optional. Weakly typed raw event data in proto struct format."
  • sessions.appendEvent returns 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.id is 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 write rawEvent, so that fix does not port directly.
  • google/adk-go#1329: same behavior in Go (open), noting that SessionEvent has no field for a client event id.
Environment
  • google-adk 1.8.0 (the same code is present in 1.10.1)
  • VertexAiSessionService on Vertex AI Agent Engine sessions
Ngôn ngữ chính
Java
Star
1.7k
Fork
433
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
52

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/adk-java

Tất cả issue của google/adk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.