You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using CopilotKit v2 useInterrupt.resolve() with AgentScope schema-only HITL tools (e.g. toolkit.registerSchema(...) / TOOL_SUSPENDED → AG-UI interrupt with reason: "tool_call"), the resumed RunAgentInput commonly contains both:
a role: "tool" message with the user payload (toolCallId = call_xxx)
a resume[] entry for the same interrupt / tool call
AguiMessageConverter.toMsgList currently converts both into ToolResultBlock with the same id. ReActAgent then throws:
Duplicate tool result ID: call_xxx
Why this is not fixed on the CopilotKit side alone
CopilotKit #6201 / #6470 only stops synthesizing client tool results for non-tool_call interrupts. AgentScope schema-only / permission-bound interrupts intentionally use reason: "tool_call", so CopilotKit still dual-sends tool message + resume[] by design (keeps chat history well-formed).
The official agentscope-copilotkit example primarily demos permission ASK / frontend useHumanInTheLoop, which do not hit this path. Schema-only requestHumanApproval on the default agent does.
Run until requestHumanApproval emits RUN_FINISHED with interrupt (reason=tool_call).
Resume with CopilotKit-shaped payload: same toolCallId in messagesandresume[].
Observe RUN_ERROR / Duplicate tool result ID.
We reproduced this against local 2.0.3-SNAPSHOT.
Expected
Converter should be idempotent for ordinary tool resumes: if a ToolResultBlock for that id already exists from messages, skip generating another from resume.
Permission-confirm resumes must still produce USER ConfirmResult (they are not ToolResultBlock duplicates).
Proposed fix
In AguiMessageConverter.toMsgList(RunAgentInput, Map):
collect existing ToolResultBlock ids from converted messages
for non-permission-confirm resumes, skip when id already present
prefer the message-history result (CopilotKit already wrote the payload there)
Root Cause: In AguiMessageConverter.toMsgList(RunAgentInput, Map<String, Interrupt>) (~lines 192–211), both input paths are converted and concatenated without deduplication:
role:"tool" messages produce a ToolResultBlock built from aguiMessage.getToolCallId() (addTextBlock, ~lines 261–278);
each resume[] entry produces a second ToolResultBlock with the same id via toToolResultMsg(resume, toolCallId) (~line 379).
ReActAgent.validateAndAddToolResults() (~lines 2207–2212) then rejects the duplicated id with IllegalStateException("Duplicate tool result ID: ...").
Impact: CopilotKit v2 resume flows with schema-only / permission-bound HITL interrupts (reason:"tool_call") fail with RUN_ERROR whenever the payload carries both the tool message and the resume entry — which CopilotKit does by design for this interrupt type. Severity: high
Suggested fix direction: deduplicate in toMsgList — when a resume[] entry covers a toolCallId, skip (or merge) the corresponding role:"tool" message before building the Msg list.
An automated fix proposal will be generated. Reply /approve to proceed with PR generation.
Hi, I'd like to work on this issue if it is still available.
I reviewed the confirmed conversion path in AguiMessageConverter.toMsgList(...): input messages are converted first, and each ordinary resume entry is then appended as another ToolResultBlock without checking whether the same tool-call ID already exists in the converted message history.
I plan to:
Collect existing ToolResultBlock IDs from the converted input messages.
Skip only non-permission-confirm resume entries whose tool-call ID is already present, preserving the message-history result.
Keep permission-confirm resumes on the existing USER ConfirmResult path unchanged.
Add focused regression tests covering the duplicate CopilotKit payload, resume-only input, different tool-call IDs, and permission-confirm resumes.
Run the AG-UI extension test suite and Spotless checks.
Could you please assign this issue to me before I begin implementation? Thank you!
Activity
oss-maintainer commentedon Sep 3, 2026
Issue Evaluation
Category:
bug| Status: ConfirmedVerified against current
main(8a78d6c).Root Cause: In
AguiMessageConverter.toMsgList(RunAgentInput, Map<String, Interrupt>)(~lines 192–211), both input paths are converted and concatenated without deduplication:role:"tool"messages produce aToolResultBlockbuilt fromaguiMessage.getToolCallId()(addTextBlock, ~lines 261–278);resume[]entry produces a secondToolResultBlockwith the same id viatoToolResultMsg(resume, toolCallId)(~line 379).ReActAgent.validateAndAddToolResults()(~lines 2207–2212) then rejects the duplicated id withIllegalStateException("Duplicate tool result ID: ...").Impact: CopilotKit v2 resume flows with schema-only / permission-bound HITL interrupts (
reason:"tool_call") fail withRUN_ERRORwhenever the payload carries both the tool message and the resume entry — which CopilotKit does by design for this interrupt type.Severity: high
Suggested fix direction: deduplicate in
toMsgList— when aresume[]entry covers atoolCallId, skip (or merge) the correspondingrole:"tool"message before building theMsglist.An automated fix proposal will be generated. Reply
/approveto proceed with PR generation.Automated evaluation by github-manager-bot
ZYZ666-RGB commentedon Sep 3, 2026
Hi, I'd like to work on this issue if it is still available.
I reviewed the confirmed conversion path in
AguiMessageConverter.toMsgList(...): input messages are converted first, and each ordinary resume entry is then appended as anotherToolResultBlockwithout checking whether the same tool-call ID already exists in the converted message history.I plan to:
ToolResultBlockIDs from the converted input messages.ConfirmResultpath unchanged.Could you please assign this issue to me before I begin implementation? Thank you!
fix(agui): dedupe resume tool results already present in messages (#2955