Interactions API: store(false) omits "id", breaking Interaction and InteractionCompletedEvent deserialization
メンテナーはふだん 1 日以内に返信
@hemasekhar-p がすでに取り組んでいます。
2026年10月5日 から。
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- Java
- スター
- 398
- フォーク
- 126
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 71
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/java-genai のほかの issue
-
ResponseStream.close() can block on the reader lock before closing the HTTP response対応中かも @hirematha が 2 日前に担当しました。 オープンpriority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
googleapis/java-genai#1372 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Interactions API: GaosClientException.getMessage() only returns "400 . API error occurred" and omits the server error details対応中かも @hemasekhar-p が 26 日前に担当しました。 オープンpriority: p2 type: bug
googleapis/java-genai#1282 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Interaction.outputText() always returns Optional.empty() (SDK-computed field is never populated)対応中かも @hemasekhar-p が 26 日前に担当しました。 オープンpriority: p2 type: bug
googleapis/java-genai#1280 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Gen AI with structured output - `propertyOrdering` in Python vs. Java implementations対応中かも @hemasekhar-p が 80 日前に担当しました。 オープンpriority: p3 type: feature request
googleapis/java-genai#1169 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Live API: no way to observe session close or connection errors after setup対応中かも @hemasekhar-p が 89 日前に担当しました。 オープンpriority: p3 type: feature request
googleapis/java-genai#1153 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
googleapis/java-genai の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
quarkusio/quarkus-agent-mcp#302 ·
メンテナーはふだん 2 日以内に返信
-
build
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
MetricsHub/metricshub-community#1472 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
IdentityArrayObjectSet iterator remove may throw ArrayIndexOutOfBoundsException対応中かも @jiteshkhatri11 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
javapathfinder/jpf-core#660 · コメント 1 件 ·