[Bug]: 0.3.3.Final - Agent terminates early when ADK tool returning RxJava Single hops threads
Maintainers usually reply within 1 day
@malladinagarjuna2 is already working on this.
Since Aug 9, 2026.
- #1027 by @malladinagarjuna2 — open
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- kotlin
- Domain
- ai-infra-agents, backend
Research direction
The bug is in the cleanupProducer method of DefaultRequestHandler where the ChildQueue closes early when an RxJava Single hops threads. Look at the agent endpoint handling and how it waits for asynchronous tool results. Start by reproducing with a Kotlin tool that uses rxSingle on a different dispatcher. Check the 1.0.0 fix with AgentEmitter to understand the resolution. The fix likely involves proper synchronization or waiting for the Single's completion on the new thread.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Java
- Stars
- 514
- Forks
- 200
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 53
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from a2aproject/a2a-java
-
Document 1.x is the actively supported stream, and not 0.3.xPossibly taken @Linux2010 claimed this 2 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
a2aproject/a2a-java#1321 ·
Maintainers usually reply within 1 day
-
HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableErrorMay be free again @ravismash claimed this 9 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
a2aproject/a2a-java#1298 · 5 comments ·
Maintainers usually reply within 1 day
-
fix: handle blank push notification config id consistently across transportsPossibly taken @prachisinghal-1 claimed this 23 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2aproject/a2a-java#1012 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a2aproject/a2a-java#464 · 1 comment ·
Maintainers usually reply within 1 day
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksMay be free again @tanish111 claimed this 390 days ago, and no pull request is open. Opensample
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
a2aproject/a2a-java#375 · 5 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in a2aproject/a2a-java
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/skywalking#14239 ·
Maintainers usually reply within 1 day
-
Re-executed query with IN condition on an index column returns deleted rows (stale IndexCursor)Possibly taken @dbusche claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
h2database/h2database#4580 ·
Maintainers usually reply within 1 day
-
vips-drift
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Stirling-Tools/JPDFium#300 ·
Maintainers usually reply within 1 day
-
hermes-queue
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
chrisalunlloyd2-sudo/mindpalace#403 ·
Maintainers usually reply within 1 day
-
Guidelines: document how to build a use case against a local, unpublished Flow/browserless-test changePossibly taken @totally-not-ai claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
vaadin/use-cases#452 · 1 comment ·
Maintainers usually reply within 1 day