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
CopilotChat: message sent while a confirmation card is pending vanishes until the card is answered #8263
In CopilotChat (v2), trigger a useHumanInTheLoop tool so a confirmation card waits for the user.
Without answering the card, type a follow-up and press Enter.
✅ Expected Behavior
The input clears and the message is visible in the conversation as accepted. It is sent once the card resolves.
❌ Actual Behavior
The input clears, but the message appears nowhere. It shows up, and is actually sent, only after the card is answered. Until then it looks as though the message was thrown away.
The v2 send flow clears the composer immediately, but adds the queued user message only after the active HITL run settles. That explains why the text is eventually sent yet invisible while the confirmation card waits. The fix should stage the accepted user message in visible chat state immediately, then dispatch that same message after the interrupt resolves without duplicating it.
Technical details and sources
The current React v2 implementation confirms the sequencing:
The composer clears before the deferred submission runs.
Submission waits for waitForActiveRunToSettle().
agent.addMessage(...) occurs only after that wait.
Therefore, the existing submission queue serializes dispatch but does not provide a visible pending-message entry. The message has not been rejected; it is held inside the queued callback, which explains the delayed appearance.
A suitable fix is:
Create/render a pending user-message entry as soon as Enter is accepted.
Keep the actual agent dispatch queued behind the active HITL run.
Reuse the staged message when calling agent.addMessage or the corresponding agent update, so it is sent exactly once.
Handle thread changes or failed runs by restoring or marking the staged entry instead of silently dropping it.
A regression test should pause a useHumanInTheLoop run, submit a second prompt, assert that the second user message is visible before resolving the card, resolve the card, and assert that the prompt is dispatched exactly once with no duplicate rendered message. No retrieved evidence establishes that this behavior is fixed or shipped in a released package version.
Applies to: React `CopilotChat` v2; the reporter supplied main commit c7815d9, and current main contains the same clear-then-await-then-add ordering. No released package version was supplied.
Thanks for the analysis! The PR follows it closely: the message shows as soon as Enter is accepted, the send stays queued behind the confirmation card, and the shown message keeps its id when it is sent, so it is sent exactly once and never duplicated. The regression test is the one suggested here: pause on the card, send, check the message is visible, answer the card, and check it was sent once.
One point I intentionally handled differently: restoring a queued message after a thread switch. A queued send is never dispatched once the thread changes, and that is already the behaviour on main. Putting its text back into the new thread's input could send it to the wrong conversation, and keeping it for the original thread needs per-thread draft state that this fix doesn't otherwise touch. So the PR removes the queued bubble on a thread switch, as before, and leaves that as a possible follow-up. A failed connection does restore the text to the input, as it already did.
Happy to revisit this if maintainers would prefer it handled here.
Activity
copilotkit-outpost-bot commentedon Nov 8, 2026
The v2 send flow clears the composer immediately, but adds the queued user message only after the active HITL run settles. That explains why the text is eventually sent yet invisible while the confirmation card waits. The fix should stage the accepted user message in visible chat state immediately, then dispatch that same message after the interrupt resolves without duplicating it.
Technical details and sources
The current React v2 implementation confirms the sequencing:
waitForActiveRunToSettle().agent.addMessage(...)occurs only after that wait.Therefore, the existing submission queue serializes dispatch but does not provide a visible pending-message entry. The message has not been rejected; it is held inside the queued callback, which explains the delayed appearance.
A suitable fix is:
agent.addMessageor the corresponding agent update, so it is sent exactly once.A regression test should pause a
useHumanInTheLooprun, submit a second prompt, assert that the second user message is visible before resolving the card, resolve the card, and assert that the prompt is dispatched exactly once with no duplicate rendered message. No retrieved evidence establishes that this behavior is fixed or shipped in a released package version.Applies to: React `CopilotChat` v2; the reporter supplied main commit c7815d9, and current main contains the same clear-then-await-then-add ordering. No released package version was supplied.
API version: v2
Sources
🤖 Generated by CopilotKit AI Support · Documentation
Was this helpful? React with 👍 or 👎
HoussemDjeghri commentedon Nov 8, 2026
Thanks for the analysis! The PR follows it closely: the message shows as soon as Enter is accepted, the send stays queued behind the confirmation card, and the shown message keeps its id when it is sent, so it is sent exactly once and never duplicated. The regression test is the one suggested here: pause on the card, send, check the message is visible, answer the card, and check it was sent once.
One point I intentionally handled differently: restoring a queued message after a thread switch. A queued send is never dispatched once the thread changes, and that is already the behaviour on
main. Putting its text back into the new thread's input could send it to the wrong conversation, and keeping it for the original thread needs per-thread draft state that this fix doesn't otherwise touch. So the PR removes the queued bubble on a thread switch, as before, and leaves that as a possible follow-up. A failed connection does restore the text to the input, as it already did.Happy to revisit this if maintainers would prefer it handled here.