Skip to content

VertexAiSessionService and FirestoreSessionService appendEvent do not skip partial events #1993

Backlog

Description

@chjpooh2002

🔴 Required Information

Describe the Bug:

Follow-up to #1987 (flagged by @sahuadarsh0 in #1990): VertexAiSessionService.appendEvent and FirestoreSessionService.appendEvent also do not return early when event.partial() is true, diverging from BaseSessionService.appendEvent (BaseSessionService.java:217-235) and adk-python.

  1. VertexAiSessionService.appendEvent (core/src/main/java/com/google/adk/sessions/VertexAiSessionService.java:339-350):
    Delegates to BaseSessionService.super.appendEvent(session, event) (which returns Single.just(event) early without mutating local session state/events), but still chains .flatMap(...) and sends the partial event to client.appendEvent(...).
  2. FirestoreSessionService.appendEvent (contrib/firestore-session-service/src/main/java/com/google/adk/sessions/FirestoreSessionService.java:685-789):
    Never checks event.partial(), so partial events mutate session.state()/appState/userState, update session.lastUpdateTime, append the event to session.events(), and persist both state and event writes to Firestore.

Steps to Reproduce:

  1. Construct a VertexAiSessionService (with a mock VertexAiClient) or FirestoreSessionService (with a mock Firestore).
  2. Build an Event with partial(true) and a non-empty stateDelta.
  3. Call appendEvent(session, partialEvent).blockingGet().

Expected Behavior:

Matching BaseSessionService.appendEvent (BaseSessionService.java:217-235) and adk-python, both services should return Single.just(event) immediately when event.partial().orElse(false) is true, without invoking remote persistence (VertexAiClient.appendEvent / Firestore writes) or mutating session state, events, or lastUpdateTime.

Observed Behavior:

  • VertexAiSessionService.appendEvent still calls client.appendEvent(...) for partial events.
  • FirestoreSessionService.appendEvent still writes stateDelta, appends the event, updates lastUpdateTime, and commits Firestore writes for partial events.

Environment Details:

  • ADK Library Version: main (13ce6e3d96ebaa9b9ad84198e50ed81e6aab14f3, 1.16.1-SNAPSHOT)
  • OS: Windows
  • Java Version: OpenJDK 21.0.10 (Temurin-21.0.10+7)

Model Information:

  • Which model is being used: N/A

🟡 Optional Information

Regression:

Unknown.

Logs:

N/A

Screenshots / Video:

N/A

Additional Context:

Minimal Reproduction Code:

// VertexAiSessionService:
Event partialEvent = Event.builder().partial(true).build();
vertexAiSessionService.appendEvent(session, partialEvent).blockingGet();
// Expected: verify(mockClient, never()).appendEvent(any(), any(), any());
// Observed: mockClient.appendEvent(...) is invoked.

How often has this issue occurred?:

  • Always (100%)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions