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
{{ message }}
Repository navigation
injectInterrupt synthesizes tool results for interrupts whose agent emits the real ToolCallResult on resume #6201
ɵInterruptState builds toolResults for every standard interrupt carrying a toolCallId; the Angular controller adds them via agent.addMessage() before resuming. That's right for executor-less interrupt tools (defineTool({ interrupt: true }): reason "tool_call", interrupt.id === toolCallId, human response = result) — but it conflicts with the AG-UI interrupt spec for suspend/resume backends: "The agent does not re-emit ToolCallStart/ToolCallArgs/ToolCallEnd in the resumed run — it emits ToolCallResult against the original toolCallId." (e.g. Mastra resumeStream).
Result: two tool messages for one toolCallId. RenderToolCalls#getToolMessage uses find(), so the synthetic resume payload permanently shadows the real result (booking card shows {"selection":"creditCard"} → "Failed" despite success).
Proposal: gate the synthesis on interrupt.reason === "tool_call" (or interrupt.id === toolCallId). Backward-compatible: on resume the runtime already synthesizes the result server-side from input.resume when no client tool message exists (alreadyAnswered path). Alternatively an opt-out on InjectInterruptOptions. Happy to PR either.
⚠️ This is an AI-generated response. We've escalated this to our engineering team — someone will follow up in this thread shortly.
Thanks for the detailed report
This is a well-structured analysis — the version numbers, the reproduction path, the spec reference, and the proposed fix are all exactly what the maintainers need. Let me be transparent about what I can and can't confirm here.
What I can say from the docs:
The injectInterrupt / useInterrupt docs confirm the general shape you're describing:
Standard AG-UI interrupts carry { id, reason, message?, toolCallId?, responseSchema?, ... } on the Interrupt object
resolve(payload, interruptId?) is meant to resume the paused run
I haven't read the internals of ɵInterruptState, RenderToolCalls#getToolMessage, or the Angular controller's agent.addMessage() path — those identifiers don't appear verbatim in the documentation I have access to. So I can't verify the exact synthesis logic or confirm the shadowing behavior you're describing.
On your proposal:
One possibility is that gating toolResults synthesis on interrupt.reason === "tool_call" (or the interrupt.id === toolCallId equivalence check) would be the right scope — but whether that's the correct fix, and whether the alreadyAnswered path on the server side is a safe fallback in all runtime configurations, is a call for the engineering team to make after they've looked at the actual code paths.
What's useful about your report as-is:
✅ Specific versions pinned
✅ AG-UI spec citation with the exact conflicting behavior
✅ Concrete reproduction: Mastra resumeStream + defineTool without interrupt: true
✅ Two concrete fix options with backward-compat reasoning
✅ Offer to PR
One thing that would strengthen it further: if you can share a minimal repro (even a stripped-down agent + component), that would let the team verify the double-message behavior directly without needing to reconstruct your Mastra setup.
The team will need to verify the internal behavior and decide on the right gate condition — your PR offer is a great path forward once they've confirmed the approach.
Was this helpful, or is there anything about the injectInterrupt API surface I can clarify from the docs?
🤖 Generated by CopilotKit AI Support · Documentation
#1861 - fix: synchronously execute renderAndWaitForResponse [merged] #2031 - fix: use active interrupt from thread instead of saving to global state [merged] #2488 - fix: interrupt persistence [merged] #2638 - Feat/cpk 1.5 [merged] #5869 - docs(deepagents): add agentId parameter to useInterrupt and document state access [open]
📝 Issue Planner
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Activity
copilotkit-outpost-bot commentedon Jul 28, 2026
Thanks for the detailed report
This is a well-structured analysis — the version numbers, the reproduction path, the spec reference, and the proposed fix are all exactly what the maintainers need. Let me be transparent about what I can and can't confirm here.
What I can say from the docs:
The
injectInterrupt/useInterruptdocs confirm the general shape you're describing:{ id, reason, message?, toolCallId?, responseSchema?, ... }on theInterruptobjectresolve(payload, interruptId?)is meant to resume the paused runRUN_FINISHED→onRunFinalizedflowWhat I cannot confirm:
I haven't read the internals of
ɵInterruptState,RenderToolCalls#getToolMessage, or the Angular controller'sagent.addMessage()path — those identifiers don't appear verbatim in the documentation I have access to. So I can't verify the exact synthesis logic or confirm the shadowing behavior you're describing.On your proposal:
One possibility is that gating
toolResultssynthesis oninterrupt.reason === "tool_call"(or theinterrupt.id === toolCallIdequivalence check) would be the right scope — but whether that's the correct fix, and whether thealreadyAnsweredpath on the server side is a safe fallback in all runtime configurations, is a call for the engineering team to make after they've looked at the actual code paths.What's useful about your report as-is:
resumeStream+defineToolwithoutinterrupt: trueOne thing that would strengthen it further: if you can share a minimal repro (even a stripped-down agent + component), that would let the team verify the double-message behavior directly without needing to reconstruct your Mastra setup.
The team will need to verify the internal behavior and decide on the right gate condition — your PR offer is a great path forward once they've confirmed the approach.
Was this helpful, or is there anything about the
injectInterruptAPI surface I can clarify from the docs?🤖 Generated by CopilotKit AI Support · Documentation
Was this helpful? React with 👍 or 👎
coderabbitai commentedon Jul 28, 2026
🔗 Related PRs
#1861 - fix: synchronously execute renderAndWaitForResponse [merged]
#2031 - fix: use active interrupt from thread instead of saving to global state [merged]
#2488 - fix: interrupt persistence [merged]
#2638 - Feat/cpk 1.5 [merged]
#5869 - docs(deepagents): add agentId parameter to useInterrupt and document state access [open]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
fix(core): prevent duplicate interrupt tool results (CopilotKit#6201)
fix(core): prevent duplicate interrupt tool results (#6201) (#6470)
fix(agui): dedupe resume tool results already present in messages (#2955