[spring-ai] Streaming responses ending with CJK punctuation (。!?) are misclassified as partial and never persisted to the session
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 84/100
Piste de recherche
Commencez à contrib/spring-ai/src/main/java/com/google/adk/models/springai/MessageConverter.java, méthode isPartialResponse, qui ne vérifie que les caractères ASCII . ! ? et le saut de ligne. La reproduction minimale de l'issue appelle directement MessageConverter#toLlmResponse avec une ChatResponse se terminant par 。, donc transformez cela en un test unitaire sous contrib/spring-ai/src/test et confirmez qu'il renvoie actuellement partial=true. Terminé signifie qu'une réponse se terminant par 。!? donne partial=false, et que le nouveau test ainsi que les tests existants du module passent.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the Bug
In the Spring AI bridge (contrib/spring-ai), MessageConverter#isPartialResponse
decides whether a streaming chunk is partial by checking only ASCII sentence-ending
punctuation: ., !, ?, \n. CJK terminal punctuation (。, !, ?) is not
included.
As a result, when a model's final streaming response ends with a Chinese sentence
mark (which is the normal case for Chinese users), it is classified as partial=true
and therefore never persisted to the session — the reply silently disappears from
conversation history, breaking multi-turn context and session replay.
Steps to Reproduce
- Use the official
com.google.adk.models.springai.SpringAImodel bridge with any
OpenAI-compatible model, streaming mode (RunConfigSSE). - Send a question that produces a Chinese answer, e.g.
根因是库存扣减为 0 未拦截。 - Observe the final
LlmResponse:partialistrue, and the session event store
never receives this response.
A minimal unit-level repro (calling the converter directly) is provided below.
No exception/stacktrace is produced — the failure is silent, which is what makes it
hard to notice in production.
Expected Behavior
A response ending with 。 (or ! / ?) is a complete final response in Chinese
and should be partial=false, persisted to the session like its ASCII-. counterpart.
Observed Behavior
Verified against google-adk-spring-ai:1.9.0 on our classpath:
[PROBE] chinese-ending partial = true <-- bug: final reply treated as partial
[PROBE] ascii-ending partial = false
Downstream effect: Runner-driven sessions lose the assistant's final answer for
CJK conversations; Session.events() replay shows the question without the reply.
Live streaming looks fine (partials are forwarded to the client), so the loss only
shows up in history, multi-turn follow-ups and session replay.
Environment Details
- ADK Library Version: verified on 1.9.0, and confirmed still present in
1.11.0 (latest release) and on currentmain
(contrib/spring-ai/src/main/java/com/google/adk/models/springai/MessageConverter.java#isPartialResponse) - OS: macOS (behavior is OS-independent — pure string logic)
- TS Version: N/A (Java)
Model Information
Model-independent. Observed with GLM via an OpenAI-compatible gateway; the
classification happens in MessageConverter before any model-specific handling.
Regression
N/A — the heuristic has been present since we started using the bridge (1.9.0),
and is unchanged through 1.11.0.
Additional Context
Suggested fix, from minimal to better:
- Add CJK terminal punctuation to the check:
。!?(plus…,)). - Better: don't infer completeness from punctuation at all. Text legitimately ends
without sentence-ending characters (lists, code blocks, tables). Partial-ness
could be derived from chunk position / stream state instead of the last character.
This affects every CJK-language user of the official SpringAI bridge — and because
partials are still forwarded live, the missing persistence only surfaces later
(history / follow-up turns), which makes it easy to misdiagnose as a session-store
problem.
Minimal Reproduction Code
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.adk.models.springai.MessageConverter;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.model.Generation;
import java.util.List;
MessageConverter converter = new MessageConverter(new ObjectMapper());
ChatResponse chineseEnding = new ChatResponse(List.of(new Generation(
AssistantMessage.builder().content("根因是库存扣减为 0 未拦截。").build())));
ChatResponse asciiEnding = new ChatResponse(List.of(new Generation(
AssistantMessage.builder().content("Root cause: zero-stock deduction is not blocked.").build())));
boolean chinesePartial = converter.toLlmResponse(chineseEnding, true).partial().orElse(false); // true (bug)
boolean asciiPartial = converter.toLlmResponse(asciiEnding, true).partial().orElse(false); // false
How often has this issue occurred?
Always (100%) — every Chinese final response ending with 。, which is essentially
every conversation.
- Langage dominant
- Java
- Étoiles
- 1.7k
- Forks
- 431
- Merge moyen
- 2 j 20 h
- PR mergées (30 j)
- 42
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
-
[spring-ai] ToolConverter silently drops enum and items from tool parameter schemasPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
google/adk-java#1609 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[spring-ai] Bridge drops reasoning_content (thinking) — surface it as partial events and/or persist itPeut-être pris @hemasekhar-p l’a pris il y a 1 jour. Ouverteneeds review
google/adk-java#1616 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
needs review
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
google/adk-java#1598 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
BaseLlmFlow nests each step inside the previous one and overflows the stack after a few hundred LLM callsPeut-être pris @hemasekhar-p l’a pris il y a 8 jours. Ouverteneeds review
Difficulté 4/5 3-5 jours Accessibilité débutants 68/100
google/adk-java#1564 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Approved tool call re-runs on every later user turn if it never got a function responsePeut-être pris @hemasekhar-p l’a pris il y a 11 jours. Ouverteneeds review
google/adk-java#1556 · 1 commentaire · 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 70/100
commonmark/commonmark-java#460 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
1.21.1见幽匿感测体就崩溃Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Make branch and label autocomplete matching locale-independentPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
jenkinsci/gitlab-plugin#1950 ·
-
Place type search does not workOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
commons-app/apps-android-commons#6984 ·
Les mainteneurs répondent en général sous 2 jours