[BUG] Duplicate tool result after ask_user causes 400 "each tool_use must have a single result" on Claude
Maintainer thường phản hồi trong vòng 1 ngày
@AnantKumar17 đang làm issue này rồi.
Từ ngày 19/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 40/100
Hướng nghiên cứu
The payload points at the session history replay: GET /api/sessions/<id> returns two functionResponse entries with the same ask_user call ID, and the adk-… confirmation items are skipped. Start by finding where the Go controller converts stored session events into Responses API input items, and check how function_call_output entries are keyed by call_id. Done when the replayed history has one result per call_id, with a test that feeds in a duplicate result for the same call. The root cause is still unconfirmed, so verify it before changing the code.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
📋 Prerequisites
- I have searched the existing issues to avoid creating a duplicate
- By submitting this issue, you agree to follow our Code of Conduct
- I am using the latest version of the software
- I have tried to clear cache/cookies or used incognito mode (if ui-related)
- I can consistently reproduce this issue
🎯 Affected Service(s)
Controller Service
🚦 Impact/Severity
Minor inconvenience
🐛 Bug Description
After an agent calls ask_user and the user answers, the next model request fails with 400 Bad Request. Every later request in that session fails the same way, so the session is unusable.
The session history holds two functionResponse entries for the same ask_user call ID. When the history is replayed to the model, both are sent as results for one tool call. Claude on Bedrock rejects that, because each tool_use must have exactly one result.
kagent only shows OpenAI responses request failed: POST ".../responses": 400 Bad Request. The upstream error body is dropped, so the pod logs don't say why.
🔄 Steps To Reproduce
- Chat with an agent that has ask_user available, and get it to call ask_user. A vague request that needs clarification, like "what should I do to connect to other clusters?", works.
- Answer the question in the UI.
- Send another message, or let the agent continue.
The request after the answer fails with 400. It happened in two separate sessions for me.
To see the cause without the agent, fetch the session (GET /api/sessions/) and rebuild the history as Responses API input items: user and assistant text, function_call and function_call_output. Skip the adk-… confirmation items. POST that to the gateway's /responses endpoint with a few function tool definitions.
- As stored: 400.
- After keeping only the last function_call_output per call_id: 200.
This is my reconstruction of the replayed history, not a capture of the exact payload the agent sent.
🤔 Expected Behavior
The history sent to the model has exactly one result per tool call ID. For example, the placeholder is replaced by the final result, or dropped when the history is converted for the model.
📱 Actual Behavior
Error from the gateway
400 BAD_REQUEST
{"message":"messages.6.content.1: each tool_use must have a single result.
Found multiple tool_result blocks with id: toolu_bdrk_"}
💻 Environment
- kagent chart and images 0.10.3 (golang-adk:0.10.3, controller 0.10.3, kagent-tools 0.3.0)
- ModelConfig: provider OpenAI, apiFormat: responses, pointing at an OpenAI-compatible Responses endpoint on a Databricks AI gateway
- Model: claude-sonnet-5 (Bedrock behind the gateway), maxTokens: 8192
- Agent: the default k8s-agent
🔧 CLI Bug Report
No response
🔍 Additional Context
Version 0.10.3 does not fix this. I haven't tested the 1.0 alphas.
Related: #2836 asks for a switch to turn ask_user off, which would work around this.
Suggestion: log the upstream error body for a failed model call, with secrets redacted. Without a manual replay, the bare 400 gave no hint.
📋 Logs
📷 Screenshots
🙋 Are you willing to contribute?
- I am willing to submit a PR to fix this issue
- Ngôn ngữ chính
- Go
- Star
- 4.2k
- Fork
- 890
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 189
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kagent-dev/kagent
-
skills-init: commit-SHA skill refs never start (git checkout -- <sha> reads the SHA as a pathspec)Có thể đã có người làm @talcoh2x đã nhận 1 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
kagent-dev/kagent#3571 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Gemini catalogs omit gemini-4-argon and gemini-3.8-flashCó thể đã có người làm @jayunit100 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
kagent-dev/kagent#3524 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Don't add the provider's public host to egress when a ModelConfig sets baseUrlCó thể đã có người làm @lakshyab20 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
kagent-dev/kagent#3507 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] OpenAI and Ollama adapters send an empty tool message when a tool returns a dictCó thể đã có người làm @helloxjade đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
kagent-dev/kagent#3462 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
kagent-dev/kagent#3428 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của kagent-dev/kagent
Issue tương tự
-
GitHub webhook is not subscribed to release events, so `event: release` never triggersCó thể đã có người làm @qsun đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
woodpecker-ci/woodpecker#7542 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
zilliztech/milvus-backup#1386 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Pipelined flush no longer observes kill signals after #2042: flush backoffer is built with nil varsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
model:sonnet runtime:claude security size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FootprintAI/Containarium#3624 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày