Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserialization
I maintainer di solito rispondono entro 1 giorno
@hemasekhar-p ci sta già lavorando.
Dal 5/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Environment
com.google.genai:google-genai:1.73.0- Java 21+
Problem Description
When creating a stateless interaction with .store(false) on CreateModelInteraction, the Gemini Interactions API server does not persist the interaction and therefore omits the "id" field from the "interaction" JSON object in responses and SSE events (and omits "interaction_id" in interaction.status_update SSE events).
For example, the server sends the following SSE payload at the end of a store(false) stream:
{
"interaction": {
"status": "completed",
"usage": {
"input_tokens_by_modality": [{"modality": "text", "tokens": 19}],
"total_input_tokens": 19,
"total_output_tokens": 4,
"total_thought_tokens": 0,
"total_tokens": 23
},
"created": "2026-10-04T19:11:19Z",
"updated": "2026-10-04T19:11:19Z",
"service_tier": "standard",
"object": "interaction",
"model": "gemini-3.1-flash-lite-preview"
},
"event_type": "interaction.completed"
}
However, in com.google.genai.gaos.models.interactions, the id / interactionId fields are generated as @Nonnull String and enforce non-nullability in their @JsonCreator constructors:
InteractionSseEventInteraction.<init>(InteractionSseEventInteraction.java:123):this.id = Optional.ofNullable(id) .orElseThrow(() -> new IllegalArgumentException("id cannot be null"));InteractionStatusUpdate.<init>: throwsIllegalArgumentException("interactionId cannot be null")Interaction.<init>: throwsIllegalArgumentException("id cannot be null")
Because "id" is absent when store(false) is used:
- In streaming mode (
stream(true)+store(false)):InteractionSseEventInteraction.<init>throwsIllegalArgumentException: id cannot be nullduring Jackson deserialization. The SSE union deserializer catches the failure and silently falls back toUnknownInteractionSSEEvent(witheventType() == "UNKNOWN"andasJson()containing aTextNodeof the raw JSON string) forinteraction.created,interaction.status_update, andinteraction.completed. As a result, callers matchingInteractionCompletedEventnever receive the completion event orUsagetoken counts. - In non-streaming mode (
stream(false)+store(false)):Interaction.<init>fails withValueInstantiationException: Cannot construct instance of com.google.genai.gaos.models.interactions.Interaction, problem: id cannot be null.
Steps to Reproduce
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.InteractionCompletedEvent;
import com.google.genai.gaos.models.interactions.InteractionSSEEvent;
import com.google.genai.gaos.models.interactions.InteractionSSEStreamEvent;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.UnknownInteractionSSEEvent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
public class Repro {
public static void main(String[] args) throws Exception {
Client client = Client.builder().build();
var request =
CreateModelInteraction.builder()
.model(Model.GEMINI_3_1_FLASH_LITE_PREVIEW)
.input(InteractionsInput.of("Say hello in one word."))
.store(false)
.stream(true)
.build();
try (var events =
client.interactions.create(CreateInteractionRequestBody.of(request)).events()) {
for (InteractionSSEStreamEvent streamEvent : events) {
InteractionSSEEvent event = streamEvent.data().orElseThrow();
if (event instanceof InteractionCompletedEvent completed) {
System.out.println("Completed usage: " + completed.interaction().get().usage());
} else if (event instanceof UnknownInteractionSSEEvent unknown) {
System.out.println("Fell back to UnknownInteractionSSEEvent: " + unknown.asJson());
}
}
}
}
}
Expected Behavior
Interaction.id, InteractionSseEventInteraction.id, and InteractionStatusUpdate.interactionId should be optional/nullable (Optional<String>) in the OpenAPI specification and generated SDK classes so that store(false) responses and InteractionCompletedEvent SSE events deserialize properly.
- Lingua principale
- Java
- Stelle
- 398
- Fork
- 126
- Merge medio
- 1g 12h
- PR unite (30g)
- 71
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di googleapis/java-genai
-
priority: p2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleapis/java-genai#1372 ·
I maintainer di solito rispondono entro 1 giorno
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error detailsForse già presa @hemasekhar-p l’ha presa 24 giorni fa. Apertapriority: p2 type: bug
googleapis/java-genai#1282 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)Forse già presa @hemasekhar-p l’ha presa 24 giorni fa. Apertapriority: p2 type: bug
googleapis/java-genai#1280 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementationsForse già presa @hemasekhar-p l’ha presa 78 giorni fa. Apertapriority: p3 type: feature request
googleapis/java-genai#1169 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Live API: no way to observe session close or connection errors after setupForse già presa @hemasekhar-p l’ha presa 87 giorni fa. Apertapriority: p3 type: feature request
googleapis/java-genai#1153 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di googleapis/java-genai
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
quarkiverse/quarkus-google-cloud-services#1188 ·
I maintainer di solito rispondono entro 1 giorno
-
Component: Frontend Component: Web Component Type: Maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
it-at-m/refarch-templates#1944 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
-
GeoSeries scale and skew tests fail with pytest 9.2.0Forse già presa @jiayuasu l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Preventions: a dose saved without a unit reopens blank, and an unchanged save then erases itForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertapriority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
carlos-emr/carlos#5431 ·
I maintainer di solito rispondono entro 1 giorno