[Bug]: 0.3.3.Final - Agent terminates early when ADK tool returning RxJava Single hops threads
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- kotlin
- Ambito
- ai-infra-agents, backend
Direzione di ricerca
Il bug si trova nel metodo cleanupProducer di DefaultRequestHandler, dove ChildQueue viene chiusa prematuramente quando un RxJava Single cambia thread. Esamina la gestione dell’endpoint dell’agente e il modo in cui attende i risultati asincroni degli strumenti. Inizia riproducendo il problema con uno strumento Kotlin che usa rxSingle su un Dispatcher diverso. Controlla il fix della versione 1.0.0 con AgentEmitter per comprendere la risoluzione. Il fix probabilmente comporta una sincronizzazione corretta oppure l’attesa del completamento del Single sul nuovo thread.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
When an ADK tool returns an RxJava Single executes on a different thread to the executor, the agent endpoint returns right after the function call is made. I noticed this bug using Kotlin, where using rxSingle executes on the global dispatcher, rather than the executor, e.g:
@Schema(description = "Get the weather summary in a city")
fun getWeather(@Schema(name = "city", description = "City to query") city: String): Single<Map<String, Any>> {
return rxSingle {
mapOf<String, Any>("result" to "It's 50 degrees and partly cloudy in $city")
}
}
When running an agent with this tool, e.g. with message/send, the result cuts out after the tool call.
{
"jsonrpc": "2.0",
"id": "cli-check-2",
"result": {
"id": "565c05e1-8bfc-414c-950e-80d74e14350c",
"contextId": "cli-demo-context",
"status": {
"state": "working",
"timestamp": "2026-05-12T15:09:36.256177Z"
},
"artifacts": [
{
"artifactId": "80c03215-3225-4108-9f7f-040d5ad2ec82",
"parts": [
{
"data": {
"name": "getWeather",
"id": "adk-183771c0-58a0-4f1b-87e9-d406ffaef646",
"args": {
"city": "Edinburgh"
}
},
"metadata": {
"adk_type": "function_call"
},
"kind": "data"
}
],
"metadata": {}
}
],
"history": [
{
"role": "user",
"parts": [
{
"text": "What is the weather in Edinburgh?",
"kind": "text"
}
],
"messageId": "cli-check-2",
"contextId": "cli-demo-context",
"taskId": "565c05e1-8bfc-414c-950e-80d74e14350c",
"kind": "message"
}
],
"kind": "task"
}
}
Using rxSingle(Dispatchers.Unconfined) works only if the function never actually suspends, otherwise the issue persists. A Java equivalent would be to e.g. call .subscribeOn(Schedulers.io()) on the Single, or any other change of Scheduler.
The issue appears to be in the cleanupProducer method of the DefaultRequestHandler, where the ChildQueue is closed prematurely. It does appear to be fixed in 1.0.0 with AgentEmitter - but I'm unsure if we'll be able to adopt it yet as the ADK doesn't support it (I've raised an issue for it here). Is there any chance a fix could be backported to 0.3? I'm happy to provide help if needed.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Java
- Stelle
- 514
- Fork
- 200
- Merge medio
- 1g 2h
- PR unite (30g)
- 53
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 a2aproject/a2a-java
-
Document 1.x is the actively supported stream, and not 0.3.xForse già presa @Linux2010 l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
a2aproject/a2a-java#1321 ·
I maintainer di solito rispondono entro 1 giorno
-
HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableErrorForse di nuovo libera @ravismash l’ha presa 9 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
a2aproject/a2a-java#1298 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
fix: handle blank push notification config id consistently across transportsForse già presa @prachisinghal-1 l’ha presa 23 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
a2aproject/a2a-java#1012 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-java#464 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksForse di nuovo libera @tanish111 l’ha presa 390 giorni fa e non c’è nessuna pull request aperta. Apertasample
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
a2aproject/a2a-java#375 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di a2aproject/a2a-java
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/skywalking#14239 ·
I maintainer di solito rispondono entro 1 giorno
-
Re-executed query with IN condition on an index column returns deleted rows (stale IndexCursor)Forse già presa @dbusche l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
h2database/h2database#4580 ·
I maintainer di solito rispondono entro 1 giorno
-
vips-drift
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Stirling-Tools/JPDFium#300 ·
I maintainer di solito rispondono entro 1 giorno
-
hermes-queue
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
chrisalunlloyd2-sudo/mindpalace#403 ·
I maintainer di solito rispondono entro 1 giorno
-
Guidelines: document how to build a use case against a local, unpublished Flow/browserless-test changeForse già presa @totally-not-ai l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
vaadin/use-cases#452 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno